Commit 97b6aa36 authored by Robert Edmonds's avatar Robert Edmonds

use double underscores in the MAGIC identifiers

these magic constants aren't intended for use by client code. add a
double underscore to indicate this.
parent d0cadf1a
...@@ -75,16 +75,16 @@ ...@@ -75,16 +75,16 @@
/* Assertions for magic numbers. */ /* Assertions for magic numbers. */
#define ASSERT_IS_ENUM_DESCRIPTOR(desc) \ #define ASSERT_IS_ENUM_DESCRIPTOR(desc) \
assert((desc)->magic == PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC) assert((desc)->magic == PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC)
#define ASSERT_IS_MESSAGE_DESCRIPTOR(desc) \ #define ASSERT_IS_MESSAGE_DESCRIPTOR(desc) \
assert((desc)->magic == PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC) assert((desc)->magic == PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC)
#define ASSERT_IS_MESSAGE(message) \ #define ASSERT_IS_MESSAGE(message) \
ASSERT_IS_MESSAGE_DESCRIPTOR((message)->descriptor) ASSERT_IS_MESSAGE_DESCRIPTOR((message)->descriptor)
#define ASSERT_IS_SERVICE_DESCRIPTOR(desc) \ #define ASSERT_IS_SERVICE_DESCRIPTOR(desc) \
assert((desc)->magic == PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC) assert((desc)->magic == PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC)
/* --- version --- */ /* --- version --- */
...@@ -2661,7 +2661,7 @@ protobuf_c_message_check(const ProtobufCMessage *message) ...@@ -2661,7 +2661,7 @@ protobuf_c_message_check(const ProtobufCMessage *message)
{ {
if (!message || if (!message ||
!message->descriptor || !message->descriptor ||
message->descriptor->magic != PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC) message->descriptor->magic != PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC)
{ {
return FALSE; return FALSE;
} }
......
...@@ -505,9 +505,9 @@ do { \ ...@@ -505,9 +505,9 @@ do { \
/* ====== private ====== */ /* ====== private ====== */
#define PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC 0x14159bc3 #define PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC 0x14159bc3
#define PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC 0x28aaeef9 #define PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC 0x28aaeef9
#define PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC 0x114315af #define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af
/* /*
* A little enum helper macro: this will ensure that your enum's size is * A little enum helper macro: this will ensure that your enum's size is
......
...@@ -272,7 +272,7 @@ void EnumGenerator::GenerateEnumDescriptor(io::Printer* printer) { ...@@ -272,7 +272,7 @@ void EnumGenerator::GenerateEnumDescriptor(io::Printer* printer) {
printer->Print(vars, printer->Print(vars,
"const ProtobufCEnumDescriptor $lcclassname$__descriptor =\n" "const ProtobufCEnumDescriptor $lcclassname$__descriptor =\n"
"{\n" "{\n"
" PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,\n" " PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC,\n"
" \"$fullname$\",\n" " \"$fullname$\",\n"
" \"$shortname$\",\n" " \"$shortname$\",\n"
" \"$cname$\",\n" " \"$cname$\",\n"
......
...@@ -467,7 +467,7 @@ GenerateMessageDescriptor(io::Printer* printer) { ...@@ -467,7 +467,7 @@ GenerateMessageDescriptor(io::Printer* printer) {
printer->Print(vars, printer->Print(vars,
"const ProtobufCMessageDescriptor $lcclassname$__descriptor =\n" "const ProtobufCMessageDescriptor $lcclassname$__descriptor =\n"
"{\n" "{\n"
" PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,\n" " PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,\n"
" \"$fullname$\",\n" " \"$fullname$\",\n"
" \"$shortname$\",\n" " \"$shortname$\",\n"
" \"$classname$\",\n" " \"$classname$\",\n"
......
...@@ -226,7 +226,7 @@ void ServiceGenerator::GenerateServiceDescriptor(io::Printer* printer) ...@@ -226,7 +226,7 @@ void ServiceGenerator::GenerateServiceDescriptor(io::Printer* printer)
printer->Print(vars_, "const ProtobufCServiceDescriptor $lcfullname$__descriptor =\n" printer->Print(vars_, "const ProtobufCServiceDescriptor $lcfullname$__descriptor =\n"
"{\n" "{\n"
" PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC,\n" " PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC,\n"
" \"$fullname$\",\n" " \"$fullname$\",\n"
" \"$name$\",\n" " \"$name$\",\n"
" \"$cname$\",\n" " \"$cname$\",\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