summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-03-20 02:02:42 +0300
committerDmitry Stogov <dmitry@zend.com>2015-03-20 02:02:42 +0300
commitd146d15003442a2e5234dd2fab1605094dc21630 (patch)
tree3a20cd8866a8544ed8bfd04b8c71f7041b4ca91e /ext/pgsql/pgsql.c
parent184793b5c1e7a9df67e542893b69bace5cd7a67c (diff)
downloadphp-git-d146d15003442a2e5234dd2fab1605094dc21630.tar.gz
Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate()
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 4cbd218450..6e37f18287 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -4362,7 +4362,7 @@ PHP_FUNCTION(pg_escape_string)
to->len = PQescapeString(to->val, from->val, from->len);
}
- to = zend_string_realloc(to, to->len, 0);
+ to = zend_string_truncate(to, to->len, 0);
RETURN_NEW_STR(to);
}
/* }}} */
@@ -6048,7 +6048,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
str = zend_string_alloc(Z_STRLEN_P(val) * 2, 0);
/* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */
str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
- str = zend_string_realloc(str, str->len, 0);
+ str = zend_string_truncate(str, str->len, 0);
ZVAL_NEW_STR(&new_val, str);
php_pgsql_add_quotes(&new_val, 1);
}