Differences From Artifact [af06feb764]:
- File
src/runtime/property.m
— part of check-in
[5358e9ea6a]
at
2019-08-01 20:14:35
on branch trunk
— Split threading.[hm] into multiple files
This allows the runtime to only link against the parts it needs, without
pulling in unnecessary parts like thread spawning, TLS and conditions. (user: js, size: 3294) [annotate] [blame] [check-ins using]
To Artifact [b52cba63b9]:
- File src/runtime/property.m — part of check-in [44f5a7d029] at 2019-12-12 01:04:03 on branch trunk — runtime: Make properties opaque and provide an API (user: js, size: 5574) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
152 153 154 155 156 157 158 | #endif return; } memcpy(dest, src, size); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | #endif return; } memcpy(dest, src, size); } objc_property_t * class_copyPropertyList(Class class, unsigned int *outCount) { unsigned int i, count; struct objc_property_list *iter; objc_property_t *properties; if (class == Nil) { if (outCount != NULL) *outCount = 0; return NULL; } objc_global_mutex_lock(); count = 0; if (class->info & OBJC_CLASS_INFO_NEW_ABI) for (iter = class->propertyList; iter != NULL; iter = iter->next) count += iter->count; if (count == 0) { if (outCount != NULL) *outCount = 0; objc_global_mutex_unlock(); return NULL; } properties = malloc((count + 1) * sizeof(objc_property_t)); if (properties == NULL) OBJC_ERROR("Not enough memory to copy properties"); i = 0; for (iter = class->propertyList; iter != NULL; iter = iter->next) for (unsigned int j = 0; j < iter->count; j++) properties[i++] = &iter->properties[j]; OF_ENSURE(i == count); properties[count] = NULL; if (outCount != NULL) *outCount = count; objc_global_mutex_unlock(); return properties; } const char * property_getName(objc_property_t property) { return property->name; } char * property_copyAttributeValue(objc_property_t property, const char *name) { char *ret = NULL; bool nullIsError = false; if (strlen(name) != 1) return NULL; switch (*name) { case 'T': ret = of_strdup(property->getter.typeEncoding); nullIsError = true; break; case 'G': if (property->attributes & OBJC_PROPERTY_GETTER) { ret = of_strdup(property->getter.name); nullIsError = true; } break; case 'S': if (property->attributes & OBJC_PROPERTY_SETTER) { ret = of_strdup(property->setter.name); nullIsError = true; } break; #define BOOL_CASE(name, field, flag) \ case name: \ if (property->field & flag) { \ ret = calloc(1, 1); \ nullIsError = true; \ } \ break; BOOL_CASE('R', attributes, OBJC_PROPERTY_READONLY) BOOL_CASE('C', attributes, OBJC_PROPERTY_COPY) BOOL_CASE('&', attributes, OBJC_PROPERTY_RETAIN) BOOL_CASE('N', attributes, OBJC_PROPERTY_NONATOMIC) BOOL_CASE('D', extendedAttributes, OBJC_PROPERTY_DYNAMIC) BOOL_CASE('W', extendedAttributes, OBJC_PROPERTY_WEAK) #undef BOOL_CASE } if (nullIsError && ret == NULL) OBJC_ERROR("Not enough memory to copy property attribute " "value"); return ret; } |