ObjFW  Diff

Differences From Artifact [ca6dc099de]:

To Artifact [d18abfb3eb]:


126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
126
127
128
129
130
131
132

133

134
135
136
137
138
139
140

141
142
143
144
145
146
147







-
+
-







-







		}

		/* Look if there's a newline or \0 */
		for (i = 0; i < len; i++) {
			if (OF_UNLIKELY(tmp[i] == '\n' || tmp[i] == '\0')) {
				@try {
					ret_c = [self
					    allocMemoryWithSize: cache_len +
					    allocMemoryWithSize: cache_len + i];
								 i + 1];
				} @catch (OFException *e) {
					[self freeMemory: tmp];
					@throw e;
				}
				if (cache != NULL)
					memcpy(ret_c, cache, cache_len);
				memcpy(ret_c + cache_len, tmp, i);
				ret_c[cache_len + i] = '\0';

				if (i < len) {
					@try {
						tmp2 = [self
						    allocMemoryWithSize: len -
									 i - 1];
					} @catch (OFException *e) {
164
165
166
167
168
169
170
171


172
173
174
175
176
177
178
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176
177







-
+
+







					cache_len = 0;
				}
				[self freeMemory: tmp];

				@try {
					ret = [OFString
					    stringWithCString: ret_c
						     encoding: encoding];
						     encoding: encoding
						       length: cache_len + i];
				} @finally {
					[self freeMemory: ret_c];
				}
				return ret;
			}
		}