diff options
author | Andrey Hristov <andrey@php.net> | 2010-04-28 12:29:13 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2010-04-28 12:29:13 +0000 |
commit | 1838fcc7b09be4c94b7fbb1516c2a162c56b2f7b (patch) | |
tree | 53288e41d8847dc3bceb00d0af341739f6c90b81 | |
parent | 5031bfc395bd9cc5a29389d5fe458c3452643b76 (diff) | |
download | php-git-1838fcc7b09be4c94b7fbb1516c2a162c56b2f7b.tar.gz |
const-ify fields
-rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 12 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 9 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.h | 2 |
3 files changed, 11 insertions, 12 deletions
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 83b80cc43d..401c3b0454 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -63,12 +63,12 @@ typedef struct st_mysqlnd_cmd_buffer typedef struct st_mysqlnd_field { - char *name; /* Name of column */ - char *org_name; /* Original column name, if an alias */ - char *table; /* Table of column if column was a field */ - char *org_table; /* Org table name, if table was an alias */ - char *db; /* Database for table */ - char *catalog; /* Catalog for table */ + const char *name; /* Name of column */ + const char *org_name; /* Original column name, if an alias */ + const char *table; /* Table of column if column was a field */ + const char *org_table; /* Org table name, if table was an alias */ + const char *db; /* Database for table */ + const char *catalog; /* Catalog for table */ char *def; /* Default value (set by mysql_list_fields) */ unsigned long length; /* Width of column (create length) */ unsigned long max_length; /* Max width for selected set */ diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 5457541983..845000a799 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -70,7 +70,7 @@ static const char *unknown_sqlstate= "HY000"; -char * const mysqlnd_empty_string = ""; +const char * const mysqlnd_empty_string = ""; /* Used in mysqlnd_debug.c */ const char mysqlnd_read_header_name[] = "mysqlnd_read_header"; @@ -927,13 +927,13 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC) BAIL_IF_NO_MORE_DATA; switch ((len)) { case 0: - *(char **)(((char*)meta) + rset_field_offsets[i]) = mysqlnd_empty_string; + *(const char **)(((char*)meta) + rset_field_offsets[i]) = mysqlnd_empty_string; *(unsigned int *)(((char*)meta) + rset_field_offsets[i+1]) = 0; break; case MYSQLND_NULL_LENGTH: goto faulty_or_fake; default: - *(char **)(((char *)meta) + rset_field_offsets[i]) = (char *)p; + *(const char **)(((char *)meta) + rset_field_offsets[i]) = (const char *)p; *(unsigned int *)(((char*)meta) + rset_field_offsets[i+1]) = len; p += len; total_len += len + 1; @@ -989,6 +989,7 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC) (len = php_mysqlnd_net_field_length(&p)) && len != MYSQLND_NULL_LENGTH) { + BAIL_IF_NO_MORE_DATA; DBG_INF_FMT("Def found, length %lu, persistent=%d", len, packet->persistent_alloc); meta->def = mnd_pemalloc(len + 1, packet->persistent_alloc); memcpy(meta->def, p, len); @@ -997,8 +998,6 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC) p += len; } - BAIL_IF_NO_MORE_DATA; - DBG_INF_FMT("allocing root. persistent=%d", packet->persistent_alloc); root_ptr = meta->root = mnd_pemalloc(total_len, packet->persistent_alloc); meta->root_len = total_len; diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index f4f79af469..64dc5528a6 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -254,7 +254,7 @@ PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * c unsigned long php_mysqlnd_net_field_length(zend_uchar **packet); zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length); -PHPAPI extern char * const mysqlnd_empty_string; +PHPAPI const extern char * const mysqlnd_empty_string; void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields, |