diff options
author | Nuno Lopes <nlopess@php.net> | 2008-01-25 19:57:57 +0000 |
---|---|---|
committer | Nuno Lopes <nlopess@php.net> | 2008-01-25 19:57:57 +0000 |
commit | b89396b11ed1b73c5c2ffe12352305e9be3aff97 (patch) | |
tree | b3beb6947216b709b3edbb09c9ba0c7ec713bcaa /ext/pdo/pdo_sqlstate.c | |
parent | 2c1a5c02489b0a2050415d9a3c0c15cfe081d653 (diff) | |
download | php-git-b89396b11ed1b73c5c2ffe12352305e9be3aff97.tar.gz |
move about 3K of data to the const area. also reduce memory usage (~ -266 bytes :P)
Diffstat (limited to 'ext/pdo/pdo_sqlstate.c')
-rw-r--r-- | ext/pdo/pdo_sqlstate.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/pdo/pdo_sqlstate.c b/ext/pdo/pdo_sqlstate.c index eaa3fdb9c5..6924e4f008 100644 --- a/ext/pdo/pdo_sqlstate.c +++ b/ext/pdo/pdo_sqlstate.c @@ -29,13 +29,13 @@ #include "php_pdo_driver.h" struct pdo_sqlstate_info { - char state[6]; + const char state[5]; const char *desc; }; static HashTable err_hash; -static struct pdo_sqlstate_info err_initializer[] = { +static const struct pdo_sqlstate_info err_initializer[] = { { "00000", "No error" }, { "01000", "Warning" }, { "01001", "Cursor operation conflict" }, @@ -312,7 +312,7 @@ void pdo_sqlstate_fini_error_table(void) int pdo_sqlstate_init_error_table(void) { int i; - struct pdo_sqlstate_info *info; + const struct pdo_sqlstate_info *info; if (FAILURE == zend_hash_init(&err_hash, sizeof(err_initializer)/sizeof(err_initializer[0]), NULL, NULL, 1)) { @@ -330,7 +330,7 @@ int pdo_sqlstate_init_error_table(void) const char *pdo_sqlstate_state_to_description(char *state) { - struct pdo_sqlstate_info **info; + const struct pdo_sqlstate_info **info; if (SUCCESS == zend_hash_find(&err_hash, state, sizeof(err_initializer[0].state), (void**)&info)) { return (*info)->desc; |