ObjFW  Diff

Differences From Artifact [2b51c08162]:

To Artifact [31d446cae5]:


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdarg.h>
#include <stdbool.h>
#include <wchar.h>

#include <sys/types.h>

#import "OFString.h"
#import "OFAutoreleasePool.h"
#import "asprintf.h"

#import "macros.h"

#define MAX_SUBFORMAT_LEN 64

struct context {
	const char *format;
	size_t formatLen;







|

|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdarg.h>
#include <stdbool.h>
#include <wchar.h>

#include <sys/types.h>

#import "OFString.h"

#import "asprintf.h"
#import "autorelease.h"
#import "macros.h"

#define MAX_SUBFORMAT_LEN 64

struct context {
	const char *format;
	size_t formatLen;
285
286
287
288
289
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
	case '@':
		ctx->subformat[ctx->subformatLen - 1] = 's';

		@try {
			id object;

			if ((object = va_arg(ctx->arguments, id)) != nil) {
				OFAutoreleasePool *pool;

				pool = [[OFAutoreleasePool alloc] init];
				tmpLen = asprintf(&tmp, ctx->subformat,
				    [[object description] UTF8String]);
				[pool release];

			} else
				tmpLen = asprintf(&tmp, ctx->subformat,
				    "(nil)");
		} @catch (id e) {
			free(ctx->buffer);
			@throw e;
		}







|

<


|
>







285
286
287
288
289
290
291
292
293

294
295
296
297
298
299
300
301
302
303
304
	case '@':
		ctx->subformat[ctx->subformatLen - 1] = 's';

		@try {
			id object;

			if ((object = va_arg(ctx->arguments, id)) != nil) {
				void *pool = objc_autoreleasePoolPush();


				tmpLen = asprintf(&tmp, ctx->subformat,
				    [[object description] UTF8String]);

				objc_autoreleasePoolPop(pool);
			} else
				tmpLen = asprintf(&tmp, ctx->subformat,
				    "(nil)");
		} @catch (id e) {
			free(ctx->buffer);
			@throw e;
		}