ObjFW  Diff

Differences From Artifact [b49c70c5e4]:

To Artifact [6a33891d13]:

  • File src/OFList.m — part of check-in [033054ad75] at 2009-05-29 19:21:57 on branch trunk — A few renames.

    OFExceptions:
    * OFNoMemException to OFOutOfMemoryException.
    * OFMemNotPartOfObjException to OFMemoryNotPartOfObjectException.

    OFObject:
    * -[addItemToMemoryPool:] to -[addMemoryToPool:].
    * -[allocWithSize:] to -[allocMemoryWithSize:].
    * -[allocNItems:withSize] to -[allocMemoryForNItems:withSize:].
    * -[resizeMem:toSize] to -[resizeMemory:toSize:].
    * -[resizeMem:toNItems:withSize:] to
    -[resizeMemoryToNItems:withSize:].
    * -[freeMem] to -[freeMemory:].

    OFString:
    * -[urlencode] to -[urlEncodedString].
    * -[urldecode] to -[urlDecodedString]. (user: js, size: 3853) [annotate] [blame] [check-ins using]


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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

110

111
112
113
114
115
116
117
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120







-
+

+



















-
+

+




















-
+

+







- (of_list_object_t*)last
{
	return last;
}

- (of_list_object_t*)append: (id)obj
{
	of_list_object_t *o = [self allocWithSize: sizeof(of_list_object_t)];
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = obj;
	o->next = NULL;
	o->prev = last;

	if (last != NULL)
		last->next = o;

	last = o;
	if (first == NULL)
		first = o;

	if (retain_and_release)
		[obj retain];

	return o;
}

- (of_list_object_t*)prepend: (id)obj
{
	of_list_object_t *o = [self allocWithSize: sizeof(of_list_object_t)];
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = obj;
	o->next = first;
	o->prev = NULL;

	if (first != NULL)
		first->prev = o;

	first = o;
	if (last == NULL)
		last = o;

	if (retain_and_release)
		[obj retain];

	return o;
}

- (of_list_object_t*)insert: (id)obj
		     before: (of_list_object_t*)listobj
{
	of_list_object_t *o = [self allocWithSize: sizeof(of_list_object_t)];
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = obj;
	o->next = listobj;
	o->prev = listobj->prev;

	if (listobj->prev != NULL)
		listobj->prev->next = o;

125
126
127
128
129
130
131
132

133

134
135
136
137
138
139
140
128
129
130
131
132
133
134

135
136
137
138
139
140
141
142
143
144







-
+

+








	return o;
}

- (of_list_object_t*)insert: (id)obj
		      after: (of_list_object_t*)listobj
{
	of_list_object_t *o = [self allocWithSize: sizeof(of_list_object_t)];
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = obj;
	o->next = listobj->next;
	o->prev = listobj;

	if (listobj->next != NULL)
		listobj->next->prev = o;

160
161
162
163
164
165
166
167

168
169
170
171
172
173
174
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178







-
+







		first = listobj->next;
	if (last == listobj)
		last = listobj->prev;

	if (retain_and_release)
		[listobj->object release];

	[self freeMem: listobj];
	[self freeMemory: listobj];

	return self;
}

- (size_t)count
{
	size_t i;
210
211
212
213
214
215
216
217

218
219
220
221
222
223
224
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228







-
+







		new = [[OFList alloc] initWithoutRetainAndRelease];

	o = NULL;
	prev = NULL;

	@try {
		for (iter = first; iter != NULL; iter = iter->next) {
			o = [new allocWithSize: sizeof(of_list_object_t)];
			o = [new allocMemoryWithSize: sizeof(of_list_object_t)];
			o->object = iter->object;
			o->next = NULL;
			o->prev = prev;

			if (new->first == NULL)
				new->first = o;
			if (prev != NULL)