Skip to content

Commit

Permalink
Auto-generate files after cl/590420044
Browse files Browse the repository at this point in the history
  • Loading branch information
protobuf-team-bot committed Dec 13, 2023
1 parent 3d597c2 commit 95d7dc0
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 4 deletions.
19 changes: 19 additions & 0 deletions php/ext/google/protobuf/php-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -5928,6 +5928,25 @@ void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner) {
}


#include <stddef.h>
#include <stdint.h>


// Must be last.

const upb_Message_Extension* upb_Message_FindExtensionByNumber(
const upb_Message* msg, uint32_t field_number) {
size_t count = 0;
const upb_Message_Extension* ext = _upb_Message_Getexts(msg, &count);

while (count--) {
if (upb_MiniTableExtension_Number(ext->ext) == field_number) return ext;
ext++;
}
return NULL;
}


#include <string.h>


Expand Down
34 changes: 32 additions & 2 deletions php/ext/google/protobuf/php-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,8 @@ bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,

// Must be last.

typedef struct upb_Message_Extension upb_Message_Extension;

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -1747,14 +1749,14 @@ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
// This is rather wasteful for scalars (in the extreme case of bool,
// it wastes 15 bytes). We accept this because we expect messages to be
// the most common extension type.
typedef struct {
struct upb_Message_Extension {
const upb_MiniTableExtension* ext;
union {
upb_StringView str;
void* ptr;
char scalar_data[8];
} data;
} upb_Message_Extension;
};

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -12383,6 +12385,34 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,

#endif // UPB_PORT_ATOMIC_H_

#ifndef UPB_MESSAGE_COMPAT_H_
#define UPB_MESSAGE_COMPAT_H_

#include <stdint.h>


// Must be last.

// upb does not support mixing minitables from different sources but these
// functions are still used by some existing users so for now we make them
// available here. This may or may not change in the future so do not add
// them to new code.

#ifdef __cplusplus
extern "C" {
#endif

// Returns the extension with the given field number, or NULL on failure.
const upb_Message_Extension* upb_Message_FindExtensionByNumber(
const upb_Message* msg, uint32_t field_number);

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif /* UPB_MESSAGE_COMPAT_H_ */

#ifndef UPB_MESSAGE_COPY_H_
#define UPB_MESSAGE_COPY_H_

Expand Down
19 changes: 19 additions & 0 deletions ruby/ext/google/protobuf_c/ruby-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -5442,6 +5442,25 @@ void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner) {
}


#include <stddef.h>
#include <stdint.h>


// Must be last.

const upb_Message_Extension* upb_Message_FindExtensionByNumber(
const upb_Message* msg, uint32_t field_number) {
size_t count = 0;
const upb_Message_Extension* ext = _upb_Message_Getexts(msg, &count);

while (count--) {
if (upb_MiniTableExtension_Number(ext->ext) == field_number) return ext;
ext++;
}
return NULL;
}


#include <string.h>


Expand Down
34 changes: 32 additions & 2 deletions ruby/ext/google/protobuf_c/ruby-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,8 @@ bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,

// Must be last.

typedef struct upb_Message_Extension upb_Message_Extension;

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -1749,14 +1751,14 @@ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
// This is rather wasteful for scalars (in the extreme case of bool,
// it wastes 15 bytes). We accept this because we expect messages to be
// the most common extension type.
typedef struct {
struct upb_Message_Extension {
const upb_MiniTableExtension* ext;
union {
upb_StringView str;
void* ptr;
char scalar_data[8];
} data;
} upb_Message_Extension;
};

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -12155,6 +12157,34 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,

#endif // UPB_PORT_ATOMIC_H_

#ifndef UPB_MESSAGE_COMPAT_H_
#define UPB_MESSAGE_COMPAT_H_

#include <stdint.h>


// Must be last.

// upb does not support mixing minitables from different sources but these
// functions are still used by some existing users so for now we make them
// available here. This may or may not change in the future so do not add
// them to new code.

#ifdef __cplusplus
extern "C" {
#endif

// Returns the extension with the given field number, or NULL on failure.
const upb_Message_Extension* upb_Message_FindExtensionByNumber(
const upb_Message* msg, uint32_t field_number);

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif /* UPB_MESSAGE_COMPAT_H_ */

#ifndef UPB_MESSAGE_COPY_H_
#define UPB_MESSAGE_COPY_H_

Expand Down

0 comments on commit 95d7dc0

Please sign in to comment.