Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
f5e8ee41
Unverified
Commit
f5e8ee41
authored
Mar 06, 2019
by
Joshua Haberman
Committed by
GitHub
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHP updates for new upb APIs (#5604)
parent
37581380
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
17 deletions
+16
-17
Makefile.am
Makefile.am
+1
-0
builtin_descriptors.inc
php/ext/google/protobuf/builtin_descriptors.inc
+0
-0
def.c
php/ext/google/protobuf/def.c
+0
-0
encode_decode.c
php/ext/google/protobuf/encode_decode.c
+0
-0
message.c
php/ext/google/protobuf/message.c
+1
-1
protobuf.h
php/ext/google/protobuf/protobuf.h
+9
-8
storage.c
php/ext/google/protobuf/storage.c
+2
-5
upb.c
php/ext/google/protobuf/upb.c
+0
-0
upb.h
php/ext/google/protobuf/upb.h
+0
-0
tests.sh
tests.sh
+3
-3
No files found.
Makefile.am
View file @
f5e8ee41
...
...
@@ -591,6 +591,7 @@ php_EXTRA_DIST= \
php/README.md
\
php/composer.json
\
php/ext/google/protobuf/array.c
\
php/ext/google/protobuf/builtin_descriptors.inc
\
php/ext/google/protobuf/config.m4
\
php/ext/google/protobuf/def.c
\
php/ext/google/protobuf/encode_decode.c
\
...
...
php/ext/google/protobuf/builtin_descriptors.inc
0 → 100644
View file @
f5e8ee41
This diff is collapsed.
Click to expand it.
php/ext/google/protobuf/def.c
View file @
f5e8ee41
This diff is collapsed.
Click to expand it.
php/ext/google/protobuf/encode_decode.c
View file @
f5e8ee41
This diff is collapsed.
Click to expand it.
php/ext/google/protobuf/message.c
View file @
f5e8ee41
...
...
@@ -494,7 +494,7 @@ void Message_construct(zval* msg, zval* array_wrapper) {
ZVAL_OBJ
(
submsg
,
desc
->
klass
->
create_object
(
desc
->
klass
TSRMLS_CC
));
Message_construct
(
submsg
,
NULL
);
MessageHeader
*
to
=
UNBOX
(
MessageHeader
,
submsg
);
const
upb_filedef
*
file
=
upb_
def_file
(
upb_msgdef_upcast
(
submsgdef
)
);
const
upb_filedef
*
file
=
upb_
msgdef_file
(
submsgdef
);
if
(
!
strcmp
(
upb_filedef_name
(
file
),
"google/protobuf/wrappers.proto"
)
&&
Z_TYPE_P
(
CACHED_PTR_TO_ZVAL_PTR
((
CACHED_VALUE
*
)
value
))
!=
IS_OBJECT
)
{
const
upb_fielddef
*
value_field
=
upb_msgdef_itof
(
submsgdef
,
1
);
...
...
php/ext/google/protobuf/protobuf.h
View file @
f5e8ee41
...
...
@@ -763,7 +763,12 @@ PHP_METHOD(DescriptorPool, getEnumDescriptorByClassName);
PHP_PROTO_WRAP_OBJECT_START
(
InternalDescriptorPool
)
upb_symtab
*
symtab
;
HashTable
*
pending_list
;
upb_handlercache
*
fill_handler_cache
;
upb_handlercache
*
pb_serialize_handler_cache
;
upb_handlercache
*
json_serialize_handler_cache
;
upb_handlercache
*
json_serialize_handler_preserve_cache
;
upb_pbcodecache
*
fill_method_cache
;
upb_json_codecache
*
json_fill_method_cache
;
PHP_PROTO_WRAP_OBJECT_END
PHP_METHOD
(
InternalDescriptorPool
,
getGeneratedPool
);
...
...
@@ -773,6 +778,7 @@ void internal_add_generated_file(const char* data, PHP_PROTO_SIZE data_len,
InternalDescriptorPool
*
pool
,
bool
use_nested_submsg
TSRMLS_DC
);
void
init_generated_pool_once
(
TSRMLS_D
);
void
add_handlers_for_message
(
const
void
*
closure
,
upb_handlers
*
h
);
// wrapper of generated pool
#if PHP_MAJOR_VERSION < 7
...
...
@@ -789,15 +795,10 @@ void internal_descriptor_pool_free(zend_object* object);
extern
InternalDescriptorPool
*
generated_pool
;
// The actual generated pool
PHP_PROTO_WRAP_OBJECT_START
(
Descriptor
)
InternalDescriptorPool
*
pool
;
const
upb_msgdef
*
msgdef
;
MessageLayout
*
layout
;
zend_class_entry
*
klass
;
// begins as NULL
const
upb_handlers
*
fill_handlers
;
const
upb_pbdecodermethod
*
fill_method
;
const
upb_json_parsermethod
*
json_fill_method
;
const
upb_handlers
*
pb_serialize_handlers
;
const
upb_handlers
*
json_serialize_handlers
;
const
upb_handlers
*
json_serialize_handlers_preserve
;
PHP_PROTO_WRAP_OBJECT_END
PHP_METHOD
(
Descriptor
,
getClass
);
...
...
@@ -1168,7 +1169,7 @@ PHP_METHOD(RepeatedFieldIter, valid);
// -----------------------------------------------------------------------------
PHP_PROTO_WRAP_OBJECT_START
(
Oneof
)
upb_oneofdef
*
oneofdef
;
const
upb_oneofdef
*
oneofdef
;
int
index
;
// Index of field in oneof. -1 if not set.
char
value
[
NATIVE_SLOT_MAX_SIZE
];
PHP_PROTO_WRAP_OBJECT_END
...
...
php/ext/google/protobuf/storage.c
View file @
f5e8ee41
...
...
@@ -553,11 +553,11 @@ const zend_class_entry* field_type_class(
const
upb_fielddef
*
field
PHP_PROTO_TSRMLS_DC
)
{
if
(
upb_fielddef_type
(
field
)
==
UPB_TYPE_MESSAGE
)
{
Descriptor
*
desc
=
UNBOX_HASHTABLE_VALUE
(
Descriptor
,
get_def_obj
(
upb_fielddef_subdef
(
field
)));
Descriptor
,
get_def_obj
(
upb_fielddef_
msg
subdef
(
field
)));
return
desc
->
klass
;
}
else
if
(
upb_fielddef_type
(
field
)
==
UPB_TYPE_ENUM
)
{
EnumDescriptor
*
desc
=
UNBOX_HASHTABLE_VALUE
(
EnumDescriptor
,
get_def_obj
(
upb_fielddef_subdef
(
field
)));
EnumDescriptor
,
get_def_obj
(
upb_fielddef_
enum
subdef
(
field
)));
return
desc
->
klass
;
}
return
NULL
;
...
...
@@ -742,16 +742,13 @@ MessageLayout* create_layout(const upb_msgdef* msgdef) {
}
layout
->
size
=
off
;
layout
->
msgdef
=
msgdef
;
upb_msgdef_ref
(
layout
->
msgdef
,
&
layout
->
msgdef
);
return
layout
;
}
void
free_layout
(
MessageLayout
*
layout
)
{
FREE
(
layout
->
fields
);
upb_msgdef_unref
(
layout
->
msgdef
,
&
layout
->
msgdef
);
FREE
(
layout
);
}
...
...
php/ext/google/protobuf/upb.c
View file @
f5e8ee41
This diff is collapsed.
Click to expand it.
php/ext/google/protobuf/upb.h
View file @
f5e8ee41
This diff is collapsed.
Click to expand it.
tests.sh
View file @
f5e8ee41
...
...
@@ -18,12 +18,12 @@ internal_build_cpp() {
./autogen.sh
./configure
CXXFLAGS
=
"-fPIC -std=c++11"
# -fPIC is needed for python cpp test.
# See python/setup.py for more details
make
-j
4
make
-j
$(
nproc
)
}
build_cpp
()
{
internal_build_cpp
make check
-j
4
||
(
cat
src/test-suite.log
;
false
)
make check
-j
$(
nproc
)
||
(
cat
src/test-suite.log
;
false
)
cd
conformance
&&
make test_cpp
&&
cd
..
# The benchmark code depends on cmake, so test if it is installed before
...
...
@@ -77,7 +77,7 @@ build_cpp_distcheck() {
fi
# Do the regular dist-check for C++.
make distcheck
-j
4
make distcheck
-j
$(
nproc
)
}
build_csharp
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment