ObjFW  Diff

Differences From Artifact [35d52654ca]:

  • File src/of_asprintf.m — part of check-in [7267f55840] at 2021-01-01 18:36:01 on branch trunk — Better fallback asprintf() implementation

    Instead of trying if it's C99 compliant and falling back to a 64 KB
    buffer if it is not, resize the buffer in powers of 2 until it fits.

    The problem is that some implementations that are not compliant with C99
    don't just return -1 for a length of 0, but actually crash (e.g. HP-UX). (user: js, size: 16630) [annotate] [blame] [check-ins using]

To Artifact [00ae3c010b]:


301
302
303
304
305
306
307
308
309
310
311
312
313
314
315

		break;
	case 'z':
#if defined(OF_WINDOWS)
		if (sizeof(size_t) == 8)
			if (!appendSubformat(ctx, "I64", 3))
				return false;
#elif defined(_NEWLIB_VERSION)
		if (!appendSubformat(ctx, "l", 1))
			return false;
#else
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;
#endif








|







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315

		break;
	case 'z':
#if defined(OF_WINDOWS)
		if (sizeof(size_t) == 8)
			if (!appendSubformat(ctx, "I64", 3))
				return false;
#elif defined(_NEWLIB_VERSION) || defined(OF_HPUX)
		if (!appendSubformat(ctx, "l", 1))
			return false;
#else
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;
#endif