Overview
Comment: | Fix objc_exit() and add it to tests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7baf58021d0ec4bbd75bda47827a2bd7 |
User & Date: | js on 2013-03-09 09:24:45 |
Other Links: | manifest | tags |
Context
2013-03-09
| ||
09:45 | Fix a few missing dealloc methods. check-in: b149669549 user: js tags: trunk | |
09:24 | Fix objc_exit() and add it to tests. check-in: 7baf58021d user: js tags: trunk | |
2013-03-08
| ||
23:00 | Take advantage of realloc(NULL, n) being defined. check-in: e8d6ca16e7 user: js tags: trunk | |
Changes
Modified src/runtime/class.m from [c828b98623] to [9014452587].
︙ | ︙ | |||
579 580 581 582 583 584 585 | const char* object_getClassName(id obj) { return object_getClass(obj)->name; } | | | > > | | > > | > > | > > > > > > | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | const char* object_getClassName(id obj) { return object_getClass(obj)->name; } void objc_free_class(Class rcls) { struct objc_abi_class *cls = (struct objc_abi_class*)rcls; if (rcls->subclass_list != NULL) { free(rcls->subclass_list); rcls->subclass_list = NULL; } if (rcls->dtable != NULL && rcls->dtable != empty_dtable) objc_sparsearray_free(rcls->dtable); rcls->dtable = NULL; if (rcls->superclass != Nil) cls->superclass = rcls->superclass->name; objc_hashtable_set(classes, cls->name, NULL); } void objc_free_all_classes(void) { uint32_t i; if (classes == NULL) return; for (i = 0; i <= classes->last_idx; i++) { if (classes->data[i] != NULL) { Class cls = classes->data[i]->obj; if (cls == Nil) continue; objc_free_class(cls); objc_free_class(cls->isa); } } if (empty_dtable != NULL) { objc_sparsearray_free(empty_dtable); empty_dtable = NULL; } objc_hashtable_free(classes); classes = NULL; } |
Modified src/runtime/runtime-private.h from [466c124f70] to [987c0ee218].
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 135 136 137 138 139 | extern void objc_register_all_categories(struct objc_abi_symtab*); extern struct objc_category** objc_categories_for_class(Class); extern void objc_free_all_categories(void); extern void objc_initialize_class(Class); extern void objc_update_dtable(Class); extern void objc_register_all_classes(struct objc_abi_symtab*); extern Class objc_classname_to_class(const char*); extern void objc_free_all_classes(void); extern uint32_t objc_hash_string(const char*); extern struct objc_hashtable* objc_hashtable_new(uint32_t); extern void objc_hashtable_set(struct objc_hashtable*, const char*, const void*); extern void* objc_hashtable_get(struct objc_hashtable*, const char*); extern void objc_hashtable_free(struct objc_hashtable *h); | > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | extern void objc_register_all_categories(struct objc_abi_symtab*); extern struct objc_category** objc_categories_for_class(Class); extern void objc_free_all_categories(void); extern void objc_initialize_class(Class); extern void objc_update_dtable(Class); extern void objc_register_all_classes(struct objc_abi_symtab*); extern Class objc_classname_to_class(const char*); extern void objc_free_class(Class); extern void objc_free_all_classes(void); extern uint32_t objc_hash_string(const char*); extern struct objc_hashtable* objc_hashtable_new(uint32_t); extern void objc_hashtable_set(struct objc_hashtable*, const char*, const void*); extern void* objc_hashtable_get(struct objc_hashtable*, const char*); extern void objc_hashtable_free(struct objc_hashtable *h); |
︙ | ︙ |
Modified src/runtime/sparsearray.m from [ad0ab80318] to [942cd907cc].
︙ | ︙ | |||
192 193 194 195 196 197 198 | { uint_fast16_t i; #ifdef OF_SELUID24 uint_fast16_t j; #endif for (i = 0; i < 256; i++) { | < > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | { uint_fast16_t i; #ifdef OF_SELUID24 uint_fast16_t j; #endif for (i = 0; i < 256; i++) { if (s->buckets[i]->empty) continue; #ifdef OF_SELUID24 for (j = 0; j < 256; j++) if (!s->buckets[i]->buckets[j]->empty) free(s->buckets[i]->buckets[j]); #endif free(s->buckets[i]); } |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [07d163fa23] to [d190941fab].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFString.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0); #endif int main(int argc, char *argv[]) { /* We need deterministic hashes for tests */ of_hash_seed = 0; return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @implementation TestsAppDelegate | > > > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <stdlib.h> #import "OFString.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> PSP_MODULE_INFO("ObjFW Tests", 0, 0, 0); #endif int main(int argc, char *argv[]) { #ifdef OF_OBJFW_RUNTIME atexit(objc_exit); #endif /* We need deterministic hashes for tests */ of_hash_seed = 0; return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @implementation TestsAppDelegate |
︙ | ︙ |
Modified tests/plugin/TestPlugin.m from [bab0f8b8be] to [deaa4e949a].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "TestPlugin.h" @implementation TestPlugin - (int)test: (int)num { return num * 2; } @end id init_plugin(void) { return [[[TestPlugin alloc] init] autorelease]; } | > > > > > > > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "TestPlugin.h" #ifdef OF_OBJFW_RUNTIME # import "runtime-private.h" static void __attribute__((destructor)) unload(void) { objc_free_class(objc_getClass("TestPlugin")); } #endif @implementation TestPlugin - (int)test: (int)num { return num * 2; } @end id init_plugin(void) { return [[[TestPlugin alloc] init] autorelease]; } |