mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
fixing a portability problem on some old Unices with patch from Albert
* error.c: fixing a portability problem on some old Unices with patch from Albert Chin Daniel
This commit is contained in:
11
error.c
11
error.c
@@ -21,7 +21,7 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
|
||||
...);
|
||||
|
||||
#define XML_GET_VAR_STR(msg, str) { \
|
||||
int size; \
|
||||
int size, prev_size = -1; \
|
||||
int chars; \
|
||||
char *larger; \
|
||||
va_list ap; \
|
||||
@@ -35,8 +35,13 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
|
||||
va_start(ap, msg); \
|
||||
chars = vsnprintf(str, size, msg, ap); \
|
||||
va_end(ap); \
|
||||
if ((chars > -1) && (chars < size)) \
|
||||
break; \
|
||||
if ((chars > -1) && (chars < size)) { \
|
||||
if (prev_size == chars) { \
|
||||
break; \
|
||||
} else { \
|
||||
prev_size = chars; \
|
||||
} \
|
||||
} \
|
||||
if (chars > -1) \
|
||||
size += chars + 1; \
|
||||
else \
|
||||
|
Reference in New Issue
Block a user