aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/ext/google/protobuf/protobuf.h
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-09-15 09:20:23 -0700
committerGravatar GitHub <noreply@github.com>2017-09-15 09:20:23 -0700
commit5dd818cd2226fe8e3818206c47d77b2d9571509a (patch)
treeb169803ed9125d27b7fdd41ced20bcb2ae338937 /php/ext/google/protobuf/protobuf.h
parentb04e5cba356212e4e8c66c61bbe0c3a20537c5b9 (diff)
parenta425dd97f210cd4bab979d7aad980655a7409bfe (diff)
Merge pull request #3612 from TeBoring/php-bug
Add prefix to php reserved keywords.
Diffstat (limited to 'php/ext/google/protobuf/protobuf.h')
-rw-r--r--php/ext/google/protobuf/protobuf.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index eeb145e6..23c51c64 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -77,12 +77,18 @@
#define php_proto_zend_hash_index_update_zval(ht, h, pData) \
zend_hash_index_update(ht, h, &(pData), sizeof(void*), NULL)
+#define php_proto_zend_hash_update(ht, key, key_len) \
+ zend_hash_update(ht, key, key_len, 0, 0, NULL)
+
#define php_proto_zend_hash_index_update_mem(ht, h, pData, nDataSize, pDest) \
zend_hash_index_update(ht, h, pData, nDataSize, pDest)
#define php_proto_zend_hash_index_find_zval(ht, h, pDest) \
zend_hash_index_find(ht, h, pDest)
+#define php_proto_zend_hash_find(ht, key, key_len, pDest) \
+ zend_hash_find(ht, key, key_len, pDest)
+
#define php_proto_zend_hash_index_find_mem(ht, h, pDest) \
zend_hash_index_find(ht, h, pDest)
@@ -234,6 +240,15 @@ static inline int php_proto_zend_hash_index_update_zval(HashTable* ht, ulong h,
return result != NULL ? SUCCESS : FAILURE;
}
+static inline int php_proto_zend_hash_update(HashTable* ht, const char* key,
+ size_t key_len) {
+ void* result = NULL;
+ zval temp;
+ ZVAL_LONG(&temp, 0);
+ result = zend_hash_str_update(ht, key, key_len, &temp);
+ return result != NULL ? SUCCESS : FAILURE;
+}
+
static inline int php_proto_zend_hash_index_update_mem(HashTable* ht, ulong h,
void* pData, uint nDataSize,
void** pDest) {
@@ -250,6 +265,13 @@ static inline int php_proto_zend_hash_index_find_zval(const HashTable* ht,
return result != NULL ? SUCCESS : FAILURE;
}
+static inline int php_proto_zend_hash_find(const HashTable* ht, const char* key,
+ size_t key_len, void** pDest) {
+ void* result = NULL;
+ result = zend_hash_str_find(ht, key, key_len);
+ return result != NULL ? SUCCESS : FAILURE;
+}
+
static inline int php_proto_zend_hash_index_find_mem(const HashTable* ht,
ulong h, void** pDest) {
void* result = NULL;
@@ -910,4 +932,8 @@ const zend_class_entry* field_type_class(
.bucket.obj.object))
#endif
+// Reserved name
+bool is_reserved_name(const char* name);
+bool is_valid_constant_name(const char* name);
+
#endif // __GOOGLE_PROTOBUF_PHP_PROTOBUF_H__