Skip to content

Commit 60e585c

Browse files
committed
Update staleness
1 parent 70b77de commit 60e585c

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

php/ext/google/protobuf/php-upb.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,7 +3083,6 @@ static upb_MessageValue jsondec_int(jsondec* d, const upb_FieldDef* f) {
30833083
/* Parse UINT32 or UINT64 value. */
30843084
static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
30853085
upb_MessageValue val;
3086-
memset(&val, 0, sizeof(val));
30873086

30883087
switch (jsondec_peek(d)) {
30893088
case JD_NUMBER: {
@@ -3121,7 +3120,6 @@ static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
31213120
static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) {
31223121
upb_StringView str;
31233122
upb_MessageValue val;
3124-
memset(&val, 0, sizeof(val));
31253123

31263124
switch (jsondec_peek(d)) {
31273125
case JD_NUMBER:
@@ -15769,8 +15767,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
1576915767
const upb_MiniTable* mt = upb_MessageDef_MiniTable(m);
1577015768
size_t i = *iter;
1577115769
size_t n = upb_MiniTable_FieldCount(mt);
15772-
upb_MessageValue zero;
15773-
memset(&zero, 0, sizeof(zero));
15770+
upb_MessageValue zero = upb_MessageValue_Zero();
1577415771
UPB_UNUSED(ext_pool);
1577515772

1577615773
// Iterate over normal fields, returning the first one that is set.

php/ext/google/protobuf/php-upb.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,14 @@ UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) {
10461046
#define UPB_MESSAGE_VALUE_H_
10471047

10481048
#include <stdint.h>
1049+
#include <string.h>
1050+
1051+
1052+
// Must be last.
10491053

1054+
#ifdef __cplusplus
1055+
extern "C" {
1056+
#endif
10501057

10511058
typedef union {
10521059
bool bool_val;
@@ -1068,12 +1075,29 @@ typedef union {
10681075
uintptr_t tagged_msg_val; // upb_TaggedMessagePtr
10691076
} upb_MessageValue;
10701077

1078+
UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) {
1079+
upb_MessageValue zero;
1080+
memset(&zero, 0, sizeof(zero));
1081+
return zero;
1082+
}
1083+
10711084
typedef union {
10721085
struct upb_Array* array;
10731086
struct upb_Map* map;
10741087
struct upb_Message* msg;
10751088
} upb_MutableMessageValue;
10761089

1090+
UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) {
1091+
upb_MutableMessageValue zero;
1092+
memset(&zero, 0, sizeof(zero));
1093+
return zero;
1094+
}
1095+
1096+
#ifdef __cplusplus
1097+
} /* extern "C" */
1098+
#endif
1099+
1100+
10771101
#endif /* UPB_MESSAGE_VALUE_H_ */
10781102

10791103
#ifndef UPB_MINI_TABLE_FIELD_H_

ruby/ext/google/protobuf_c/ruby-upb.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,6 @@ static upb_MessageValue jsondec_int(jsondec* d, const upb_FieldDef* f) {
25712571
/* Parse UINT32 or UINT64 value. */
25722572
static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
25732573
upb_MessageValue val;
2574-
memset(&val, 0, sizeof(val));
25752574

25762575
switch (jsondec_peek(d)) {
25772576
case JD_NUMBER: {
@@ -2609,7 +2608,6 @@ static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
26092608
static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) {
26102609
upb_StringView str;
26112610
upb_MessageValue val;
2612-
memset(&val, 0, sizeof(val));
26132611

26142612
switch (jsondec_peek(d)) {
26152613
case JD_NUMBER:
@@ -15257,8 +15255,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
1525715255
const upb_MiniTable* mt = upb_MessageDef_MiniTable(m);
1525815256
size_t i = *iter;
1525915257
size_t n = upb_MiniTable_FieldCount(mt);
15260-
upb_MessageValue zero;
15261-
memset(&zero, 0, sizeof(zero));
15258+
upb_MessageValue zero = upb_MessageValue_Zero();
1526215259
UPB_UNUSED(ext_pool);
1526315260

1526415261
// Iterate over normal fields, returning the first one that is set.

ruby/ext/google/protobuf_c/ruby-upb.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,14 @@ UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) {
10481048
#define UPB_MESSAGE_VALUE_H_
10491049

10501050
#include <stdint.h>
1051+
#include <string.h>
1052+
1053+
1054+
// Must be last.
10511055

1056+
#ifdef __cplusplus
1057+
extern "C" {
1058+
#endif
10521059

10531060
typedef union {
10541061
bool bool_val;
@@ -1070,12 +1077,29 @@ typedef union {
10701077
uintptr_t tagged_msg_val; // upb_TaggedMessagePtr
10711078
} upb_MessageValue;
10721079

1080+
UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) {
1081+
upb_MessageValue zero;
1082+
memset(&zero, 0, sizeof(zero));
1083+
return zero;
1084+
}
1085+
10731086
typedef union {
10741087
struct upb_Array* array;
10751088
struct upb_Map* map;
10761089
struct upb_Message* msg;
10771090
} upb_MutableMessageValue;
10781091

1092+
UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) {
1093+
upb_MutableMessageValue zero;
1094+
memset(&zero, 0, sizeof(zero));
1095+
return zero;
1096+
}
1097+
1098+
#ifdef __cplusplus
1099+
} /* extern "C" */
1100+
#endif
1101+
1102+
10791103
#endif /* UPB_MESSAGE_VALUE_H_ */
10801104

10811105
#ifndef UPB_MINI_TABLE_FIELD_H_

0 commit comments

Comments
 (0)