summaryrefslogtreecommitdiff
path: root/ext/gettext
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-05-06 14:29:19 +0800
committerXinchen Hui <laruence@php.net>2015-05-06 14:29:19 +0800
commit31f516b4888fcf096fe0912828948bed84f2ad1c (patch)
treef8f324d75a432dbc66b81717bff9e21462e2db89 /ext/gettext
parent76fb02123fd176d8f201a072ba2fa1930e0a991c (diff)
downloadphp-git-31f516b4888fcf096fe0912828948bed84f2ad1c.tar.gz
Use fast zpp for frequently used gettext(_)
Diffstat (limited to 'ext/gettext')
-rw-r--r--ext/gettext/gettext.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
index 91c2abb0eb..90038fad5c 100644
--- a/ext/gettext/gettext.c
+++ b/ext/gettext/gettext.c
@@ -186,15 +186,21 @@ PHP_NAMED_FUNCTION(zif_textdomain)
Return the translation of msgid for the current domain, or msgid unaltered if a translation does not exist */
PHP_NAMED_FUNCTION(zif_gettext)
{
- char *msgid, *msgstr;
- size_t msgid_len;
+ char *msgstr;
+ zend_string *msgid;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &msgid, &msgid_len) == FAILURE) {
+#ifndef FAST_ZPP
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &msgid) == FAILURE) {
return;
}
+#else
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(msgid)
+ ZEND_PARSE_PARAMETERS_END();
+#endif
- PHP_GETTEXT_LENGTH_CHECK("msgid", msgid_len)
- msgstr = gettext(msgid);
+ PHP_GETTEXT_LENGTH_CHECK("msgid", msgid->len)
+ msgstr = gettext(msgid->val);
RETURN_STRING(msgstr);
}