Skip to content

Commit

Permalink
Update src/bson.c
Browse files Browse the repository at this point in the history
  • Loading branch information
gerald-lindsly committed Mar 6, 2012
1 parent 70b9f4e commit 5b8faab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/bson.c
Expand Up @@ -33,7 +33,11 @@ static const int zero = 0;
void *( *bson_malloc_func )( size_t ) = malloc;
void *( *bson_realloc_func )( void *, size_t ) = realloc;
void ( *bson_free )( void * ) = free;
#ifdef R_SAFETY_NET
bson_printf_func bson_printf;
#else
bson_printf_func bson_printf = printf;
#endif
bson_fprintf_func bson_fprintf = fprintf;
bson_sprintf_func bson_sprintf = sprintf;

Expand Down Expand Up @@ -956,7 +960,7 @@ int bson_append_finish_array( bson *b ) {

static bson_err_handler err_handler = NULL;

bson_err_handler set_bson_err_handler( bson_err_handler func ) {
MONGO_EXPORT bson_err_handler set_bson_err_handler( bson_err_handler func ) {
bson_err_handler old = err_handler;
err_handler = func;
return old;
Expand All @@ -980,7 +984,9 @@ int _bson_errprintf( const char *format, ... ) {
va_list ap;
int ret;
va_start( ap, format );
#ifndef R_SAFETY_NET
ret = vfprintf( stderr, format, ap );
#endif
va_end( ap );

return ret;
Expand Down Expand Up @@ -1008,9 +1014,10 @@ void bson_fatal_msg( int ok , const char *msg ) {
if ( err_handler ) {
err_handler( msg );
}

#ifndef R_SAFETY_NET
bson_errprintf( "error: %s\n" , msg );
exit( -5 );
#endif
}


Expand Down

0 comments on commit 5b8faab

Please sign in to comment.