ObjFW  Diff

Differences From Artifact [e7f682556c]:

To Artifact [ac1c630c4c]:


30
31
32
33
34
35
36
37

38
39
40
41
42
43
44

45
46
47
48
49
50
51
30
31
32
33
34
35
36

37
38
39
40
41
42
43

44
45
46
47
48
49
50
51







-
+






-
+







static void
init(void)
{
	uint_fast16_t i;

	empty_level2 = malloc(sizeof(struct objc_sparsearray_level2));
	if (empty_level2 == NULL)
		ERROR("Not enough memory to allocate sparse array!");
		OBJC_ERROR("Not enough memory to allocate sparse array!");

	empty_level2->empty = YES;

#ifndef OF_SELUID16
	empty_level3 = malloc(sizeof(struct objc_sparsearray_level3));
	if (empty_level3 == NULL)
		ERROR("Not enough memory to allocate sparse array!");
		OBJC_ERROR("Not enough memory to allocate sparse array!");

	empty_level3->empty = YES;
#endif

#ifndef OF_SELUID16
	for (i = 0; i < 256; i++) {
		empty_level2->buckets[i] = empty_level3;
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82







-
+







		init();
#else
	if (empty_level2 == NULL)
		init();
#endif

	if ((s = malloc(sizeof(struct objc_sparsearray))) == NULL)
		ERROR("Not enough memory to allocate sparse array!");
		OBJC_ERROR("Not enough memory to allocate sparse array!");

	for (i = 0; i < 256; i++)
		s->buckets[i] = empty_level2;

	return s;
}

143
144
145
146
147
148
149
150


151
152
153
154
155
156
157
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158







-
+
+







	if (s->buckets[i]->empty) {
		struct objc_sparsearray_level2 *t;
		uint_fast16_t l;

		t = malloc(sizeof(struct objc_sparsearray_level2));

		if (t == NULL)
			ERROR("Not enough memory to insert into sparse array!");
			OBJC_ERROR("Not enough memory to insert into sparse "
			    "array!");

		t->empty = NO;

		for (l = 0; l < 256; l++)
#ifndef OF_SELUID16
			t->buckets[l] = empty_level3;
#else
165
166
167
168
169
170
171
172


173
174
175
176
177
178
179
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181







-
+
+







	if (s->buckets[i]->buckets[j]->empty) {
		struct objc_sparsearray_level3 *t;
		uint_fast16_t l;

		t = malloc(sizeof(struct objc_sparsearray_level3));

		if (t == NULL)
			ERROR("Not enough memory to insert into sparse array!");
			OBJC_ERROR("Not enough memory to insert into sparse "
			    "array!");

		t->empty = NO;

		for (l = 0; l < 256; l++)
			t->buckets[l] = NULL;

		s->buckets[i]->buckets[j] = t;