mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-27 22:01:02 +08:00
PROTOBUF_C_OFFSETOF -> offsetof
offsetof() conforms to the C89 standard, just call it directly.
This commit is contained in:
parent
a1fa70c9b7
commit
c96fee16c2
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user