aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/ext/google/protobuf/def.c
diff options
context:
space:
mode:
Diffstat (limited to 'php/ext/google/protobuf/def.c')
-rw-r--r--php/ext/google/protobuf/def.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c
index 421b84e5..13f7cdd6 100644
--- a/php/ext/google/protobuf/def.c
+++ b/php/ext/google/protobuf/def.c
@@ -30,9 +30,6 @@
#include "protobuf.h"
-const char* const kReservedNames[] = {"Empty", "ECHO", "ARRAY"};
-const int kReservedNamesSize = 3;
-
// Forward declare.
static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC);
static void descriptor_free_c(Descriptor* object TSRMLS_DC);
@@ -747,12 +744,16 @@ static const char *classname_prefix(const char *classname,
return prefix_given;
}
- for (i = 0; i < kReservedNamesSize; i++) {
- if (strcmp(kReservedNames[i], classname) == 0) {
- is_reserved = true;
- break;
- }
+ char* lower = ALLOC_N(char, strlen(classname) + 1);
+ i = 0;
+ while(classname[i]) {
+ lower[i] = (char)tolower(classname[i]);
+ i++;
}
+ lower[i] = 0;
+
+ is_reserved = is_reserved_name(lower);
+ FREE(lower);
if (is_reserved) {
if (package_name != NULL && strcmp("google.protobuf", package_name) == 0) {