ObjFW  Diff

Differences From Artifact [489f8ebee0]:

To Artifact [d2e16772ed]:


93
94
95
96
97
98
99

100

101
102
103
104
105
106
107
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108







+
-
+







}
#endif

#ifndef HAVE_ASPRINTF
static int
vasprintf(char **string, const char *format, va_list arguments)
{
	int length;
	size_t length, bufferLength = 128;
	size_t bufferLength = 128;

	*string = NULL;

	for (;;) {
		free(*string);

		if ((*string = malloc(bufferLength)) == NULL)
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132







-
+







			free(*string);
			return -1;
		}

		bufferLength <<= 1;
	}

	if (length != bufferLength - 1) {
	if (length > 0 && (size_t)length != bufferLength - 1) {
		char *resized = realloc(*string, length + 1);

		/* Ignore if making it smaller failed. */
		if (resized != NULL)
			*string = resized;
	}