Differences From Artifact [8c2bdd3f07]:
- File
src/runtime/static-instances.m
— part of check-in
[79fe29dbf4]
at
2019-06-17 00:38:44
on branch trunk
— Remove underscores from library & framework names
This is more compatible with the various conventions used on various
systems. (user: js, size: 2847) [annotate] [blame] [check-ins using]
To Artifact [331920028d]:
- File src/runtime/static-instances.m — part of check-in [c6d2de4312] at 2019-11-24 22:23:10 on branch trunk — runtime: Remove duplicate structs for ABI (user: js, size: 2803) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include <stdio.h> #include <stdlib.h> #import "ObjFWRT.h" #import "private.h" | | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <stdio.h> #include <stdlib.h> #import "ObjFWRT.h" #import "private.h" static struct objc_static_instances **staticInstancesList = NULL; static size_t staticInstancesCount = 0; void objc_init_static_instances(struct objc_symtab *symtab) { struct objc_static_instances **staticInstances; /* Check if the class for a static instance became available */ for (size_t i = 0; i < staticInstancesCount; i++) { Class class = objc_lookUpClass( staticInstancesList[i]->className); if (class != Nil) { |
︙ | ︙ | |||
49 50 51 52 53 54 55 | break; } staticInstancesList[i] = staticInstancesList[staticInstancesCount]; staticInstancesList = realloc(staticInstancesList, | | | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | break; } staticInstancesList[i] = staticInstancesList[staticInstancesCount]; staticInstancesList = realloc(staticInstancesList, sizeof(*staticInstancesList) * staticInstancesCount); if (staticInstancesList == NULL) OBJC_ERROR("Not enough memory for list of " "static instances!"); /* * We moved the last entry to the current index, * therefore we need to run again for the current index. */ i--; } } staticInstances = (struct objc_static_instances **) symtab->defs[symtab->classDefsCount + symtab->categoryDefsCount]; if (staticInstances == NULL) return; for (; *staticInstances != NULL; staticInstances++) { Class class = objc_lookUpClass((*staticInstances)->className); if (class != Nil) { for (id *instances = (*staticInstances)->instances; *instances != nil; instances++) object_setClass(*instances, class); } else { staticInstancesList = realloc(staticInstancesList, sizeof(*staticInstancesList) * (staticInstancesCount + 1)); if (staticInstancesList == NULL) OBJC_ERROR("Not enough memory for list of " "static instances!"); staticInstancesList[staticInstancesCount++] = |
︙ | ︙ |