Skip to content

Commit

Permalink
[ObjC] Small cleanups to package level headers
Browse files Browse the repository at this point in the history
- Reduce what headers the runtime import needs.
- Remove stale function prototype.
- Move one function to be full scoped to a single file.

PiperOrigin-RevId: 512073294
  • Loading branch information
thomasvl authored and copybara-github committed Feb 24, 2023
1 parent 1501afe commit 9c29c40
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
10 changes: 8 additions & 2 deletions objectivec/GPBMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
#import "GPBUnknownFieldSet_PackagePrivate.h"
#import "GPBUtilities_PackagePrivate.h"

// Returns a new instance that was automatically created by |autocreator| for
// its field |field|.
static GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, GPBMessage *autocreator,
GPBFieldDescriptor *field)
__attribute__((ns_returns_retained));

// Direct access is use for speed, to avoid even internally declaring things
// read/write, etc. The warning is enabled in the project to ensure code calling
// protos can turn on -Wdirect-ivar-access without issues.
Expand Down Expand Up @@ -827,8 +833,8 @@ static void ExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, BOO
}
}

GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, GPBMessage *autocreator,
GPBFieldDescriptor *field) {
static GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, GPBMessage *autocreator,
GPBFieldDescriptor *field) {
GPBMessage *message = [[msgClass alloc] init];
message->autocreator_ = autocreator;
message->autocreatorField_ = [field retain];
Expand Down
9 changes: 0 additions & 9 deletions objectivec/GPBMessage_PackagePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr;

CF_EXTERN_C_BEGIN

// Call this before using the readOnlySemaphore_. This ensures it is created only once.
void GPBPrepareReadOnlySemaphore(GPBMessage *self);

// Returns a new instance that was automatically created by |autocreator| for
// its field |field|.
GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, GPBMessage *autocreator,
GPBFieldDescriptor *field)
__attribute__((ns_returns_retained));

// Returns whether |message| autocreated this message. This is NO if the message
// was not autocreated by |message| or if it has been mutated since
// autocreation.
Expand Down
3 changes: 1 addition & 2 deletions objectivec/GPBProtocolBuffers_RuntimeSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
// clang-format on

#import "GPBDescriptor_PackagePrivate.h"
#import "GPBExtensionInternals.h"
#import "GPBMessage_PackagePrivate.h"
#import "GPBMessage.h"
#import "GPBRootObject_PackagePrivate.h"
#import "GPBUtilities_PackagePrivate.h"
2 changes: 1 addition & 1 deletion objectivec/GPBStruct.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9c29c40

Please sign in to comment.