From: Derick Rethans Date: Wed, 29 Jun 2011 11:42:34 +0000 (+0100) Subject: - Implemented the strtolower function. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=2078e50de1c4c2e336f1d9000f4fc08b4d7adcab;p=konrad%2Ftwig.git - Implemented the strtolower function. --- diff --git a/twig.c b/twig.c index e1b3f84..6e0dc83 100644 --- a/twig.c +++ b/twig.c @@ -168,8 +168,16 @@ int TWIG_CALL_BOOLEAN(zval *property, char *functionName) } -char *TWIG_STRTOLOWER(zval *item) +char *TWIG_STRTOLOWER_ZVAL(zval *item) { + char *item_dup; + + if (Z_TYPE_P(item) != IS_STRING) { + return NULL; + } + item_dup = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item)); + php_strtolower(item_dup, Z_STRLEN_P(item)); + return item_dup; } zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments)