ObjFW  Check-in [e8d6ca16e7]

Overview
Comment:Take advantage of realloc(NULL, n) being defined.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e8d6ca16e71a3dd0331b11a82752c8c7cf536e63efad6a83205096c1308693be
User & Date: js on 2013-03-08 23:00:50
Other Links: manifest | tags
Context
2013-03-09
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
22:44
Document the block types. check-in: e8473b9db8 user: js tags: trunk
Changes

Modified src/OFConstantString.m from [9960343709] to [9a6d67963b].

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

- (void*)allocMemoryWithSize: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)allocMemoryWithSize: (size_t)itemSize
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size








{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)nitems
		count: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)freeMemory: (void*)ptr
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{







|






|

>
>
>
>
>
>
>
>





<
<
<
<
<
<
<
<
|







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

- (void*)allocMemoryWithSize: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
		count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}









- (void)freeMemory: (void*)pointer
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{
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
- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size
		count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)freeMemory: (void*)ptr
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{







|






|







|







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
- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
		count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)freeMemory: (void*)pointer
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{

Modified src/runtime/class.m from [d8be8e78d1] to [c828b98623].

307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326

		if (has_load(cls)) {
			setup_class(cls);

			if (cls->info & OBJC_CLASS_INFO_SETUP)
				call_load(cls);
			else {
				if (load_queue == NULL)
					load_queue = malloc(sizeof(Class));
				else
					load_queue = realloc(load_queue,
					    sizeof(Class) *
					    (load_queue_cnt + 1));

				if (load_queue == NULL)
					OBJC_ERROR("Not enough memory for load "
					    "queue!");

				load_queue[load_queue_cnt++] = cls;
			}







<
<
<
|
|
<







307
308
309
310
311
312
313



314
315

316
317
318
319
320
321
322

		if (has_load(cls)) {
			setup_class(cls);

			if (cls->info & OBJC_CLASS_INFO_SETUP)
				call_load(cls);
			else {



				load_queue = realloc(load_queue,
				    sizeof(Class) * (load_queue_cnt + 1));


				if (load_queue == NULL)
					OBJC_ERROR("Not enough memory for load "
					    "queue!");

				load_queue[load_queue_cnt++] = cls;
			}

Modified src/runtime/static-instances.m from [24b8585e6a] to [172bc47cd5].

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
		if (cls != Nil) {
			id *instances;

			for (instances = (*si)->instances; *instances != nil;
			    instances++)
				object_setClass(*instances, cls);
		} else {
			if (static_instances == NULL)
				static_instances = malloc(sizeof(
				    struct objc_abi_static_instances*));
			else
				static_instances = realloc(static_instances,
				    sizeof(struct objc_abi_static_instances*) *
				    (static_instances_cnt + 1));

			if (static_instances == NULL)
				OBJC_ERROR("Not enough memory for list of "
				    "static instances!");

			static_instances[static_instances_cnt++] = *si;
		}
	}
}







<
<
<
<
|
|
|









75
76
77
78
79
80
81




82
83
84
85
86
87
88
89
90
91
92
93
		if (cls != Nil) {
			id *instances;

			for (instances = (*si)->instances; *instances != nil;
			    instances++)
				object_setClass(*instances, cls);
		} else {




			static_instances = realloc(static_instances,
			    sizeof(struct objc_abi_static_instances*) *
			    (static_instances_cnt + 1));

			if (static_instances == NULL)
				OBJC_ERROR("Not enough memory for list of "
				    "static instances!");

			static_instances[static_instances_cnt++] = *si;
		}
	}
}