com php-src: Use ZEND_HANDLE_NUMERIC: ext/mysqlnd/mysql nd_result_meta.c

From: Date: Wed, 25 Jun 2014 08:34:53 +0000
Subject: com php-src: Use ZEND_HANDLE_NUMERIC: ext/mysqlnd/mysql nd_result_meta.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79062@lists.php.net to get a copy of this message
Commit: 4cdea779f9cc2abf65515b69a0035d0df1e6efbd Author: Xinchen Hui <laruence@php.net> Wed, 25 Jun 2014 16:34:53 +0800 Parents: c25828e41ea1e558c10ac57a703406315cc2831c Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4cdea779f9cc2abf65515b69a0035d0df1e6efbd Log: Use ZEND_HANDLE_NUMERIC Changed paths: M ext/mysqlnd/mysqlnd_result_meta.c Diff: diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index d393009..f6e38c8 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -48,53 +48,6 @@ php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS } /* }}} */ - -/* {{{ mysqlnd_handle_numeric */ -/* - The following code is stolen from ZE - HANDLE_NUMERIC() macro from zend_hash.c - and modified for the needs of mysqlnd. -*/ -static zend_bool -mysqlnd_is_key_numeric(const char * key, size_t length, long *idx) -{ - register const char * tmp = key; - - if (*tmp=='-') { - tmp++; - } - if ((*tmp>='0' && *tmp<='9')) { - do { /* possibly a numeric index */ - const char *end=key+length-1; - - if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ - break; - } - while (tmp<end) { - if (!(*tmp>='0' && *tmp<='9')) { - break; - } - tmp++; - } - if (tmp==end && *tmp=='\0') { /* a numeric index */ - if (*key=='-') { - *idx = strtol(key, NULL, 10); - if (*idx!=LONG_MIN) { - return TRUE; - } - } else { - *idx = strtol(key, NULL, 10); - if (*idx!=LONG_MAX) { - return TRUE; - } - } - } - } while (0); - } - return FALSE; -} -/* }}} */ - - /* {{{ mysqlnd_res_meta::read_metadata */ static enum_func_status MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const meta, MYSQLND_CONN_DATA * conn TSRMLS_DC) @@ -182,10 +135,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met } /* For BC we have to check whether the key is numeric and use it like this */ - if ((meta->zend_hash_keys[i].is_numeric = - mysqlnd_is_key_numeric(field_packet->metadata->name, - field_packet->metadata->name_length + 1, - &idx))) { + if ((meta->zend_hash_keys[i].is_numeric = ZEND_HANDLE_NUMERIC(field_packet->metadata->sname, idx))) { meta->zend_hash_keys[i].key = idx; } }

« previous php.cvs (#79062) next »