]> granicus.if.org Git - php/commitdiff
Optimize it a bit - no need to dup empty string (which can be pretty common for ...
authorStanislav Malyshev <stas@php.net>
Mon, 8 Jan 2001 20:13:32 +0000 (20:13 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 8 Jan 2001 20:13:32 +0000 (20:13 +0000)
ext/standard/browscap.c

index 9383eada28adf5c26599ddeef80a19697111e4b1..04be7ea2458b3e91b91333a6626ec08da0afba36 100644 (file)
@@ -92,7 +92,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, vo
 
                                new_property = (zval *) malloc(sizeof(zval));
                                INIT_PZVAL(new_property);
-                               new_property->value.str.val = zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
+                               new_property->value.str.val = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):"";
                                new_property->value.str.len = Z_STRLEN_P(arg2);
                                new_property->type = IS_STRING;