[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] =?utf-8?q?svn:_/pecl/dbase/trunk/_dbase.c?=
From: Christoph_Michael_Becker <cmb () php ! net>
Date: 2016-10-28 23:10:45
Message-ID: svn-cmb-1477696245-340783-1738606589 () svn ! php ! net
[Download RAW message or body]
cmb Fri, 28 Oct 2016 23:10:45 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=340783
Log:
Remove unnecessary temporary ZVAL
`field` is never modified, so we don't need the temporary clone.
Changed paths:
U pecl/dbase/trunk/dbase.c
Modified: pecl/dbase/trunk/dbase.c
===================================================================
--- pecl/dbase/trunk/dbase.c 2016-10-28 22:51:58 UTC (rev 340782)
+++ pecl/dbase/trunk/dbase.c 2016-10-28 23:10:45 UTC (rev 340783)
@@ -219,20 +219,17 @@
dbf = dbht->db_fields;
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- zval tmp;
if ((field = zend_hash_index_find(fields, i)) == NULL) {
php_error_docref(NULL, E_WARNING, "unexpected error");
efree(cp);
RETURN_FALSE;
}
- tmp = *field;
- zval_copy_ctor(&tmp);
- if (Z_TYPE(tmp) == IS_DOUBLE) {
+ if (Z_TYPE_P(field) == IS_DOUBLE) {
zend_string *formatted;
size_t formatted_len;
- formatted = _php_math_number_format_ex(Z_DVAL_P(&tmp), cur_f->db_fdc, ".", 1, "", 0);
+ formatted = _php_math_number_format_ex(Z_DVAL_P(field), cur_f->db_fdc, ".", 1, "", 0);
formatted_len = ZSTR_LEN(formatted);
if (formatted_len <= cur_f->db_flen) {
size_t delta = cur_f->db_flen - formatted_len;
@@ -243,10 +240,9 @@
}
zend_string_free(formatted);
} else {
- convert_to_string(&tmp);
- snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL(tmp));
+ convert_to_string(field);
+ snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL_P(field));
}
- zval_dtor(&tmp);
t_cp += cur_f->db_flen;
}
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic