diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c index 5cafe02..51ae17a 100644 --- a/protobuf-c/protobuf-c.c +++ b/protobuf-c/protobuf-c.c @@ -81,7 +81,6 @@ do { \ } else if ((dst=((allocator)->alloc((allocator)->allocator_data,\ da__allocation_size))) == NULL) \ { \ - alloc_failed_warning(da__allocation_size, __FILE__, __LINE__);\ fail_code; \ } \ } while (0) @@ -118,25 +117,8 @@ do { \ unsigned protobuf_c_major = PROTOBUF_C_MAJOR; unsigned protobuf_c_minor = PROTOBUF_C_MINOR; -static void -alloc_failed_warning(unsigned size, const char *filename, unsigned line) -{ - fprintf(stderr, - "WARNING: out-of-memory allocating a block of size %u (%s:%u)\n", - size, filename, line); -} - /* --- allocator --- */ -static void -protobuf_c_out_of_memory_default(void) -{ - fprintf(stderr, "Out Of Memory!!!\n"); - abort(); -} - -void (*protobuf_c_out_of_memory)(void) = protobuf_c_out_of_memory_default; - static void * system_alloc(void *allocator_data, size_t size) { @@ -146,8 +128,6 @@ system_alloc(void *allocator_data, size_t size) if (size == 0) return NULL; rv = malloc(size); - if (rv == NULL) - protobuf_c_out_of_memory(); return rv; } diff --git a/protobuf-c/protobuf-c.h b/protobuf-c/protobuf-c.h index 7d68abe..dec2522 100644 --- a/protobuf-c/protobuf-c.h +++ b/protobuf-c/protobuf-c.h @@ -158,13 +158,6 @@ struct _ProtobufCAllocator */ extern PROTOBUF_C_API ProtobufCAllocator protobuf_c_default_allocator; /* settable */ -/* - * This is the function that our default allocators call when they run - * out-of-memory. The default behavior of this function is to terminate your - * program. - */ -extern PROTOBUF_C_API void (*protobuf_c_out_of_memory)(void); - /* --- append-only data buffer --- */ typedef struct _ProtobufCBuffer ProtobufCBuffer; struct _ProtobufCBuffer {