diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-07 11:17:21 +0100 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2021-01-07 15:53:47 +0000 |
commit | 792f8fb1b5548f20d4413c2988f54269421bd33f (patch) | |
tree | eab603c4547dd7ec29d419d4653ee040f7958090 | |
parent | 7aa00369b0d48d8e68dbab3c1ecd2f8f39c4a071 (diff) | |
download | php-git-792f8fb1b5548f20d4413c2988f54269421bd33f.tar.gz |
Switch name variable to zend_string
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index ab08b6e61b..6716401187 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -339,7 +339,6 @@ rewrite: } else if (query_type == PDO_PLACEHOLDER_POSITIONAL) { /* rewrite ? to :pdoX */ - char *name; const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d"; int bind_no = 1; @@ -359,10 +358,10 @@ rewrite: continue; } - name = estrndup(plc->pos, plc->len); + zend_string *name = zend_string_init(plc->pos, plc->len, 0); /* check if bound parameter is already available */ - if (!strcmp(name, "?") || (p = zend_hash_str_find_ptr(stmt->bound_param_map, name, plc->len)) == NULL) { + if (zend_string_equals_literal(name, "?") || (p = zend_hash_find_ptr(stmt->bound_param_map, name)) == NULL) { idxbuf = zend_strpprintf(0, tmpl, bind_no++); } else { idxbuf = zend_string_copy(p); @@ -374,13 +373,13 @@ rewrite: if (!skip_map && stmt->named_rewrite_template) { /* create a mapping */ - zend_hash_str_update_ptr(stmt->bound_param_map, name, plc->len, zend_string_copy(plc->quoted)); + zend_hash_update_ptr(stmt->bound_param_map, name, zend_string_copy(plc->quoted)); } /* map number to name */ zend_hash_index_update_ptr(stmt->bound_param_map, plc->bindno, zend_string_copy(plc->quoted)); - efree(name); + zend_string_release(name); } goto rewrite; |