diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-04-15 15:40:40 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-15 15:40:40 +0400 |
commit | 050d7e38ad4163e7fa65e26724d3516ce7b33601 (patch) | |
tree | 2bb49b1b73c37b35fc778e83d9353f0eb9cc12a3 /ext/dba/dba.c | |
parent | 93d3a613d82d32dd6f5499e211bfe194d60898b0 (diff) | |
download | php-git-050d7e38ad4163e7fa65e26724d3516ce7b33601.tar.gz |
Cleanup (1-st round)
Diffstat (limited to 'ext/dba/dba.c')
-rw-r--r-- | ext/dba/dba.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 9df7f34001..86c27d172e 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -1062,11 +1062,11 @@ PHP_FUNCTION(dba_key_split) } array_init(return_value); if (key[0] == '[' && (name = strchr(key, ']')) != NULL) { - add_next_index_stringl(return_value, key+1, name - (key + 1), 1); - add_next_index_stringl(return_value, name+1, key_len - (name - key + 1), 1); + add_next_index_stringl(return_value, key+1, name - (key + 1)); + add_next_index_stringl(return_value, name+1, key_len - (name - key + 1)); } else { - add_next_index_stringl(return_value, "", 0, 1); - add_next_index_stringl(return_value, key, key_len, 1); + add_next_index_stringl(return_value, "", 0); + add_next_index_stringl(return_value, key, key_len); } } /* }}} */ @@ -1215,9 +1215,12 @@ PHP_FUNCTION(dba_handlers) for(hptr = handler; hptr->name; hptr++) { if (full_info) { - add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0); + // TODO: avoid reallocation ??? + char *str = hptr->info(hptr, NULL TSRMLS_CC); + add_assoc_string(return_value, hptr->name, str); + efree(str); } else { - add_next_index_string(return_value, hptr->name, 1); + add_next_index_string(return_value, hptr->name); } } } @@ -1244,7 +1247,7 @@ PHP_FUNCTION(dba_list) } if (Z_TYPE_P(le) == le_db || Z_TYPE_P(le) == le_pdb) { info = (dba_info *)(le->ptr); - add_index_string(return_value, i, info->path, 1); + add_index_string(return_value, i, info->path); } } } |