Commit c96fee16 authored by Robert Edmonds's avatar Robert Edmonds

PROTOBUF_C_OFFSETOF -> offsetof

offsetof() conforms to the C89 standard, just call it directly.
parent a1fa70c9
......@@ -53,8 +53,6 @@
# define PROTOBUF_C_DEPRECATED
#endif
#define PROTOBUF_C_OFFSETOF(struct, member) offsetof(struct, member)
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
# ifdef PROTOBUF_C_EXPORT
# define PROTOBUF_C_API __declspec(dllexport)
......
......@@ -145,16 +145,16 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
break;
case FieldDescriptor::LABEL_OPTIONAL:
if (optional_uses_has) {
printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, has_$name$),\n");
printer->Print(variables, " offsetof($classname$, has_$name$),\n");
} else {
printer->Print(variables, " 0, /* quantifier_offset */\n");
}
break;
case FieldDescriptor::LABEL_REPEATED:
printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, n_$name$),\n");
printer->Print(variables, " offsetof($classname$, n_$name$),\n");
break;
}
printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, $name$),\n");
printer->Print(variables, " offsetof($classname$, $name$),\n");
printer->Print(variables, " $descriptor_addr$,\n");
printer->Print(variables, " $default_value$,\n");
printer->Print(variables, " $flags$, /* flags */\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