ObjFW  Diff

Differences From Artifact [8301473e4d]:

To Artifact [751ced34bb]:


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# define madvise(addr, len, advise)
#endif

#import "OFString.h"
#import "OFExceptions.h"
#import "macros.h"

#import "asprintf.h"
#import "unicode.h"

@implementation OFMutableString
- (void)_applyTable: (const of_unichar_t* const[])table
	   withSize: (size_t)table_size
{
	of_unichar_t c;







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# define madvise(addr, len, advise)
#endif

#import "OFString.h"
#import "OFExceptions.h"
#import "macros.h"

#import "of_asprintf.h"
#import "unicode.h"

@implementation OFMutableString
- (void)_applyTable: (const of_unichar_t* const[])table
	   withSize: (size_t)table_size
{
	of_unichar_t c;
228
229
230
231
232
233
234

235
236
237
238
239
240
241
242
243
244
245

246
247
248
249

250
251
252
253
254
255
256
	va_end(args);
}

- (void)appendFormat: (OFString*)fmt
       withArguments: (va_list)args
{
	char *t;


	if (fmt == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ((vasprintf(&t, [fmt cString], args)) == -1) {
		/*
		 * This is only the most likely error to happen. Unfortunately,
		 * there is no good way to check what really happened.
		 */
		@throw [OFOutOfMemoryException newWithClass: isa];

	}

	@try {
		[self appendCString: t];

	} @finally {
		free(t);
	}
}

- (void)prependString: (OFString*)str
{







>





|
<
<
<
<
|
>
|
<

|
>







228
229
230
231
232
233
234
235
236
237
238
239
240
241




242
243
244

245
246
247
248
249
250
251
252
253
254
	va_end(args);
}

- (void)appendFormat: (OFString*)fmt
       withArguments: (va_list)args
{
	char *t;
	int len;

	if (fmt == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ((len = of_vasprintf(&t, [fmt cString], args)) == -1)




		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];


	@try {
		[self appendCString: t
			 withLength: len];
	} @finally {
		free(t);
	}
}

- (void)prependString: (OFString*)str
{