ObjFW  Diff

Differences From Artifact [0afd3cde8f]:

To Artifact [9600e51a49]:


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
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
121
122
123
124
125
126
127
128
129
130
131
132


133

134
135
136
137
138




139
140
141
142
143



144
145
146
147

148
149
150
151
152
153
154
155
156
157

158

159

160
161
162


163
164
165
166
167



168
169
170
171

172
173
174
175
176
177
178
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
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
121
122



123
124
125
126

127
128




129
130
131
132
133

134
135

136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151

152
153
154

155
156


157
158
159

160
161

162
163
164
165
166
167

168
169
170
171
172
173
174
175







-
+
-
-
-
-
-
+












+
-
-
+
+



-
-



















-
-



+
+





-
-
+
+








-
-
-


+
+
-
+

-
-
-
-
+
+
+
+

-


-
+
+
+



-
+









-
+

+
-
+

-
-
+
+

-


-
+
+
+



-
+








- init
{
	self = [super init];

	@try {
		array = [[OFDataArray alloc] initWithItemSize: sizeof(id)];
	} @catch (OFException *e) {
	} @catch (id e) {
		/*
		 * We can't use [super dealloc] on OS X here. Compiler bug?
		 * [self dealloc] will do here as we check for nil in dealloc.
		 */
		[self dealloc];
		[self release];
		@throw e;
	}

	return self;
}

- initWithObject: (id)obj
{
	self = [self init];

	@try {
		[array addItem: &obj];
		[obj retain];
	} @catch (OFException *e) {
		[self dealloc];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	[obj retain];

	return self;
}

- initWithObjects: (id)first, ...
{
	id ret;
	va_list args;

	va_start(args, first);
	ret = [self initWithObject: first
			   argList: args];
	va_end(args);

	return ret;
}

- initWithObject: (id)first
	 argList: (va_list)args
{
	id obj;

	self = [self init];

	@try {
		id obj;

		[array addItem: &first];
		while ((obj = va_arg(args, id)) != nil) {
			[array addItem: &obj];
			[obj retain];
		}
	} @catch (OFException *e) {
		[self dealloc];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithCArray: (id*)objs
{
	id *obj;
	size_t count;

	self = [self init];

	@try {
		id *obj;
	count = 0;
		size_t count = 0;

	for (obj = objs; *obj != nil; obj++) {
		[*obj retain];
		count++;
	}
		for (obj = objs; *obj != nil; obj++) {
			[*obj retain];
			count++;
		}

	@try {
		[array addNItems: count
		      fromCArray: objs];
	} @catch (OFException *e) {
	} @catch (id e) {
		id *obj;

		for (obj = objs; *obj != nil; obj++)
			[*obj release];

		[self dealloc];
		[self release];
		@throw e;
	}

	return self;
}

- initWithCArray: (id*)objs
	  length: (size_t)len
{
	size_t i;
	self = [self init];

	@try {
	self = [self init];
		size_t i;

	for (i = 0; i < len; i++)
		[objs[i] retain];
		for (i = 0; i < len; i++)
			[objs[i] retain];

	@try {
		[array addNItems: len
		      fromCArray: objs];
	} @catch (OFException *e) {
	} @catch (id e) {
		size_t i;

		for (i = 0; i < len; i++)
			[objs[i] release];

		[self dealloc];
		[self release];
		@throw e;
	}

	return self;
}

- (size_t)count