Commit d0cadf1a authored by Robert Edmonds's avatar Robert Edmonds

PROTOBUF_C_ASSERT -> assert

assert() conforms to the C89 standard, just call it directly.
parent 29806689
...@@ -2727,7 +2727,7 @@ protobuf_c_service_invoke_internal(ProtobufCService *service, ...@@ -2727,7 +2727,7 @@ protobuf_c_service_invoke_internal(ProtobufCService *service,
* likely invoking a newly added method on an old service. (Although * likely invoking a newly added method on an old service. (Although
* other memory corruption bugs can cause this assertion too.) * other memory corruption bugs can cause this assertion too.)
*/ */
PROTOBUF_C_ASSERT(method_index < service->descriptor->n_methods); assert(method_index < service->descriptor->n_methods);
/* /*
* Get the array of virtual methods (which are enumerated by the * Get the array of virtual methods (which are enumerated by the
......
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
# define PROTOBUF_C_END_DECLS # define PROTOBUF_C_END_DECLS
#endif #endif
#define PROTOBUF_C_ASSERT(condition) assert(condition)
#if !defined(PROTOBUF_C_NO_DEPRECATED) #if !defined(PROTOBUF_C_NO_DEPRECATED)
# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) # if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define PROTOBUF_C_DEPRECATED __attribute__((__deprecated__)) # define PROTOBUF_C_DEPRECATED __attribute__((__deprecated__))
......
...@@ -276,21 +276,21 @@ GenerateHelperFunctionDefinitions(io::Printer* printer, bool is_submessage) ...@@ -276,21 +276,21 @@ GenerateHelperFunctionDefinitions(io::Printer* printer, bool is_submessage)
"size_t $lcclassname$__get_packed_size\n" "size_t $lcclassname$__get_packed_size\n"
" (const $classname$ *message)\n" " (const $classname$ *message)\n"
"{\n" "{\n"
" PROTOBUF_C_ASSERT (message->base.descriptor == &$lcclassname$__descriptor);\n" " assert(message->base.descriptor == &$lcclassname$__descriptor);\n"
" return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));\n" " return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));\n"
"}\n" "}\n"
"size_t $lcclassname$__pack\n" "size_t $lcclassname$__pack\n"
" (const $classname$ *message,\n" " (const $classname$ *message,\n"
" uint8_t *out)\n" " uint8_t *out)\n"
"{\n" "{\n"
" PROTOBUF_C_ASSERT (message->base.descriptor == &$lcclassname$__descriptor);\n" " assert(message->base.descriptor == &$lcclassname$__descriptor);\n"
" return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);\n" " return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);\n"
"}\n" "}\n"
"size_t $lcclassname$__pack_to_buffer\n" "size_t $lcclassname$__pack_to_buffer\n"
" (const $classname$ *message,\n" " (const $classname$ *message,\n"
" ProtobufCBuffer *buffer)\n" " ProtobufCBuffer *buffer)\n"
"{\n" "{\n"
" PROTOBUF_C_ASSERT (message->base.descriptor == &$lcclassname$__descriptor);\n" " assert(message->base.descriptor == &$lcclassname$__descriptor);\n"
" return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);\n" " return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);\n"
"}\n" "}\n"
"$classname$ *\n" "$classname$ *\n"
...@@ -307,7 +307,7 @@ GenerateHelperFunctionDefinitions(io::Printer* printer, bool is_submessage) ...@@ -307,7 +307,7 @@ GenerateHelperFunctionDefinitions(io::Printer* printer, bool is_submessage)
" ($classname$ *message,\n" " ($classname$ *message,\n"
" ProtobufCAllocator *allocator)\n" " ProtobufCAllocator *allocator)\n"
"{\n" "{\n"
" PROTOBUF_C_ASSERT (message->base.descriptor == &$lcclassname$__descriptor);\n" " assert(message->base.descriptor == &$lcclassname$__descriptor);\n"
" protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);\n" " protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);\n"
"}\n" "}\n"
); );
......
...@@ -258,7 +258,7 @@ void ServiceGenerator::GenerateCallersImplementations(io::Printer* printer) ...@@ -258,7 +258,7 @@ void ServiceGenerator::GenerateCallersImplementations(io::Printer* printer)
" $padddddddddddddddddd$ $output_typename$_Closure closure,\n" " $padddddddddddddddddd$ $output_typename$_Closure closure,\n"
" $padddddddddddddddddd$ void *closure_data)\n" " $padddddddddddddddddd$ void *closure_data)\n"
"{\n" "{\n"
" PROTOBUF_C_ASSERT (service->descriptor == &$lcfullname$__descriptor);\n" " assert(service->descriptor == &$lcfullname$__descriptor);\n"
" service->invoke(service, $index$, (const ProtobufCMessage *) input, (ProtobufCClosure) closure, closure_data);\n" " service->invoke(service, $index$, (const ProtobufCMessage *) input, (ProtobufCClosure) closure, closure_data);\n"
"}\n"); "}\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment