diff options
-rw-r--r-- | php/ext/google/protobuf/message.c | 50 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.c | 37 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.h | 11 | ||||
-rw-r--r-- | protoc-artifacts/pom.xml | 2 | ||||
-rwxr-xr-x | python/release.sh | 3 | ||||
-rwxr-xr-x | python/release/wheel/protobuf_optimized_pip.sh | 9 | ||||
-rw-r--r-- | src/google/protobuf/stubs/io_win32.cc | 2 |
7 files changed, 75 insertions, 39 deletions
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 24472682..60f2225e 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -445,8 +445,7 @@ static void init_file_wrappers(TSRMLS_D); // Define file init functions static void init_file_any(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_any) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0acd010a19676f6f676c652f70726f746f6275662f616e792e70726f746f" @@ -461,12 +460,11 @@ static void init_file_any(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_any = true; } static void init_file_api(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_api) return; init_file_source_context(TSRMLS_C); init_file_type(TSRMLS_C); init_generated_pool_once(TSRMLS_C); @@ -502,12 +500,11 @@ static void init_file_api(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_api = true; } static void init_file_duration(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_duration) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae3010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e" @@ -523,12 +520,11 @@ static void init_file_duration(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_duration = true; } static void init_file_field_mask(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_field_mask) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173" @@ -544,12 +540,11 @@ static void init_file_field_mask(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_field_mask = true; } static void init_file_empty(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_empty) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" @@ -564,12 +559,11 @@ static void init_file_empty(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_empty = true; } static void init_file_source_context(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_source_context) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f" @@ -586,12 +580,11 @@ static void init_file_source_context(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_source_context = true; } static void init_file_struct(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_struct) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e7072" @@ -621,12 +614,11 @@ static void init_file_struct(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_struct = true; } static void init_file_timestamp(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_timestamp) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae7010a1f676f6f676c652f70726f746f6275662f74696d657374616d70" @@ -642,12 +634,11 @@ static void init_file_timestamp(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_timestamp = true; } static void init_file_type(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_type) return; init_file_any(TSRMLS_C); init_file_source_context(TSRMLS_C); init_generated_pool_once(TSRMLS_C); @@ -711,12 +702,11 @@ static void init_file_type(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_type = true; } static void init_file_wrappers(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_wrappers) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e" @@ -739,7 +729,7 @@ static void init_file_wrappers(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_wrappers = true; } // ----------------------------------------------------------------------------- diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index daebb460..da00302f 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -145,6 +145,21 @@ PHP_PROTO_HASHTABLE_VALUE get_proto_obj(const char* proto) { } // ----------------------------------------------------------------------------- +// Well Known Types. +// ----------------------------------------------------------------------------- + +bool is_inited_file_any; +bool is_inited_file_api; +bool is_inited_file_duration; +bool is_inited_file_field_mask; +bool is_inited_file_empty; +bool is_inited_file_source_context; +bool is_inited_file_struct; +bool is_inited_file_timestamp; +bool is_inited_file_type; +bool is_inited_file_wrappers; + +// ----------------------------------------------------------------------------- // Reserved Name. // ----------------------------------------------------------------------------- @@ -250,6 +265,17 @@ static PHP_RINIT_FUNCTION(protobuf) { generated_pool_php = NULL; internal_generated_pool_php = NULL; + is_inited_file_any = false; + is_inited_file_api = false; + is_inited_file_duration = false; + is_inited_file_field_mask = false; + is_inited_file_empty = false; + is_inited_file_source_context = false; + is_inited_file_struct = false; + is_inited_file_timestamp = false; + is_inited_file_type = false; + is_inited_file_wrappers = false; + return 0; } @@ -288,6 +314,17 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) { } #endif + is_inited_file_any = true; + is_inited_file_api = true; + is_inited_file_duration = true; + is_inited_file_field_mask = true; + is_inited_file_empty = true; + is_inited_file_source_context = true; + is_inited_file_struct = true; + is_inited_file_timestamp = true; + is_inited_file_type = true; + is_inited_file_wrappers = true; + return 0; } diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 6ab0f134..be1de5cf 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -1172,6 +1172,17 @@ extern zend_class_entry* oneof_descriptor_type; // Well Known Type. // ----------------------------------------------------------------------------- +extern bool is_inited_file_any; +extern bool is_inited_file_api; +extern bool is_inited_file_duration; +extern bool is_inited_file_field_mask; +extern bool is_inited_file_empty; +extern bool is_inited_file_source_context; +extern bool is_inited_file_struct; +extern bool is_inited_file_timestamp; +extern bool is_inited_file_type; +extern bool is_inited_file_wrappers; + PHP_METHOD(GPBMetadata_Any, initOnce); PHP_METHOD(GPBMetadata_Api, initOnce); PHP_METHOD(GPBMetadata_Duration, initOnce); diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 0f9dd9f8..90323531 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protoc</artifactId> - <version>3.5.1</version> + <version>3.5.1-1</version> <packaging>pom</packaging> <name>Protobuf Compiler</name> <description> diff --git a/python/release.sh b/python/release.sh index 01fc5e23..a71cc7f5 100755 --- a/python/release.sh +++ b/python/release.sh @@ -19,7 +19,7 @@ function run_install_test() { chmod +x test-venv/bin/protoc source test-venv/bin/activate - pip install -i ${PYPI} protobuf==${VERSION} + pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir deactivate rm -fr test-venv } @@ -88,6 +88,7 @@ run_install_test ${TESTING_VERSION} python3.4 https://test.pypi.org/simple # Deploy egg/wheel packages to testing PyPI and test again. python setup.py bdist_egg bdist_wheel upload -r https://test.pypi.org/legacy/ + run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple run_install_test ${TESTING_VERSION} python3.4 https://test.pypi.org/simple diff --git a/python/release/wheel/protobuf_optimized_pip.sh b/python/release/wheel/protobuf_optimized_pip.sh index 064d1d2a..98306f4c 100755 --- a/python/release/wheel/protobuf_optimized_pip.sh +++ b/python/release/wheel/protobuf_optimized_pip.sh @@ -6,7 +6,7 @@ set -ex # Print usage and fail. function usage() { - echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION PYPI_USERNAME PYPI_PASSWORD" >&2 + echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION" >&2 exit 1 # Causes caller to exit because we use -e. } @@ -25,7 +25,7 @@ if [ $0 != ./protobuf_optimized_pip.sh ]; then exit 1 fi -if [ $# -lt 3 ]; then +if [ $# -lt 1 ]; then usage exit 1 fi @@ -63,7 +63,4 @@ do build_wheel $PYTHON_VERSION done -/opt/python/cp27-cp27mu/bin/twine upload wheelhouse/* <<! -$PYPI_USERNAME -$PYPI_PASSWORD -! +/opt/python/cp27-cp27mu/bin/twine upload wheelhouse/* diff --git a/src/google/protobuf/stubs/io_win32.cc b/src/google/protobuf/stubs/io_win32.cc index ad2d2d26..b59b8e48 100644 --- a/src/google/protobuf/stubs/io_win32.cc +++ b/src/google/protobuf/stubs/io_win32.cc @@ -91,7 +91,7 @@ struct CharTraits<wchar_t> { template <typename char_type> bool null_or_empty(const char_type* s) { - return s == nullptr || *s == 0; + return s == NULL || *s == 0; } // Returns true if the path starts with a drive letter, e.g. "c:". |