attempted fix for bson_ext on solaris (slyphon)
This commit is contained in:
parent
078372f869
commit
a24448d911
@ -141,7 +141,11 @@ static void write_utf8(buffer_t buffer, VALUE string, char check_null) {
|
||||
* and raise an exception if not. */
|
||||
/* TODO maybe we can use something more portable like vsnprintf instead
|
||||
* of this hack. And share it with the Python extension ;) */
|
||||
/* If we don't have ASPRINTF, there are two possibilities:
|
||||
* either use _scprintf and _snprintf on for Windows or
|
||||
* use snprintf for solaris. */
|
||||
#ifndef HAVE_ASPRINTF
|
||||
#ifdef _MSC_VER
|
||||
#define INT2STRING(buffer, i) \
|
||||
{ \
|
||||
int vslength = _scprintf("%d", i) + 1; \
|
||||
@ -149,6 +153,14 @@ static void write_utf8(buffer_t buffer, VALUE string, char check_null) {
|
||||
_snprintf(*buffer, vslength, "%d", i); \
|
||||
}
|
||||
#else
|
||||
#define INT2STRING(buffer, i) \
|
||||
{ \
|
||||
int vslength = snprintf(NULL, 0, "%d", i) + 1; \
|
||||
*buffer = malloc(vslength); \
|
||||
snprintf(*buffer, vslength, "%d", i); \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define INT2STRING(buffer, i) asprintf(buffer, "%d", i);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user