Differences From Artifact [b6ccf04769]:
- File
src/OFAdjacentArray.m
— part of check-in
[aeb403a1ed]
at
2020-10-10 14:27:37
on branch trunk
— OFObject: Change type of -[hash] to unsigned long
The internal hash is still 32 bit in most places, but this way, it is at
least not baked into the API and ABI and can be upgraded later, should
that ever be necessary. (user: js, size: 7153) [annotate] [blame] [check-ins using] [more...]
To Artifact [0ad6ceaf6f]:
- File src/OFAdjacentArray.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 7027) [annotate] [blame] [check-ins using] [more...]
1 | /* | < < | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
59 60 61 62 63 64 65 | [self release]; @throw e; } return self; } | | < | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | [self release]; @throw e; } return self; } - (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { self = [self init]; @try { id object; [_array addItem: &firstObject]; |
︙ | ︙ | |||
107 108 109 110 111 112 113 | @throw e; } @try { for (size_t i = 0; i < count; i++) [objects[i] retain]; | | < | < | < | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | @throw e; } @try { for (size_t i = 0; i < count; i++) [objects[i] retain]; [_array addItems: objects count: count]; } @catch (id e) { for (size_t i = 0; i < count; i++) [objects[i] release]; /* Prevent double-release of objects */ [_array release]; _array = nil; [self release]; @throw e; } return self; } - (instancetype)initWithObjects: (id const *)objects count: (size_t)count { self = [self init]; @try { bool ok = true; for (size_t i = 0; i < count; i++) { if (objects[i] == nil) ok = false; [objects[i] retain]; } if (!ok) @throw [OFInvalidArgumentException exception]; [_array addItems: objects count: count]; } @catch (id e) { for (size_t i = 0; i < count; i++) [objects[i] release]; [self release]; @throw e; } |
︙ | ︙ | |||
208 209 210 211 212 213 214 | } - (id)objectAtIndexedSubscript: (size_t)idx { return *((id *)[_array itemAtIndex: idx]); } | | < | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | } - (id)objectAtIndexedSubscript: (size_t)idx { return *((id *)[_array itemAtIndex: idx]); } - (void)getObjects: (id *)buffer inRange: (of_range_t)range { id const *objects = _array.items; size_t count = _array.count; if (range.length > SIZE_MAX - range.location || range.location + range.length > count) @throw [OFOutOfRangeException exception]; |
︙ | ︙ | |||
270 271 272 273 274 275 276 | @throw [OFOutOfRangeException exception]; if ([self isKindOfClass: [OFMutableArray class]]) return [OFArray arrayWithObjects: (id *)_array.items + range.location count: range.length]; | | < | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | @throw [OFOutOfRangeException exception]; if ([self isKindOfClass: [OFMutableArray class]]) return [OFArray arrayWithObjects: (id *)_array.items + range.location count: range.length]; return [OFAdjacentSubarray arrayWithArray: self range: range]; } - (bool)isEqual: (id)object { OFArray *otherArray; id const *objects, *otherObjects; size_t count; |
︙ | ︙ |