Edit report at http://bugs.php.net/bug.php?id=50157&edit=1
ID: 50157 Updated by: fel...@php.net Reported by: jille at hexon dot cx Summary: [patch] Replace !strlen(...) with !*... -Status: Open +Status: Wont fix Type: Bug Package: Performance problem Operating System: n/a PHP Version: 6SVN-2009-11-12 (SVN) New Comment: Old trunk related. Previous Comments: ------------------------------------------------------------------------ [2009-11-12 14:26:46] jille at hexon dot cx Description: ------------ The patch is self-explanatory. (And easier to read than a description). It provides a (real little) performance improvement; but it is mainly for the idea. Reproduce code: --------------- Index: ext/standard/http.c =================================================================== --- ext/standard/http.c (revision 290576) +++ ext/standard/http.c (working copy) @@ -50,7 +50,7 @@ if (!arg_sep) { arg_sep = INI_STR("arg_separator.output"); - if (!arg_sep || !strlen(arg_sep)) { + if (!arg_sep || !*arg_sep) { arg_sep = URL_DEFAULT_ARG_SEP; } } Index: ext/pdo_dblib/dblib_stmt.c =================================================================== --- ext/pdo_dblib/dblib_stmt.c (revision 290576) +++ ext/pdo_dblib/dblib_stmt.c (working copy) @@ -118,7 +118,7 @@ S->cols[i].coltype = dbcoltype(H->link, i+1); S->cols[i].name = (char*)dbcolname(H->link, i+1); - if (!strlen(S->cols[i].name)) { + if (!*(S->cols[i].name)) { if (j) { spprintf(&tmp, 0, "computed%d", j++); strlcpy(S->cols[i].name, tmp, strlen(tmp)+1); Index: ext/mbstring/mbstring.c =================================================================== --- ext/mbstring/mbstring.c (revision 290576) +++ ext/mbstring/mbstring.c (working copy) @@ -2899,7 +2899,7 @@ i--; } - if (_from_encodings != NULL && !strlen(_from_encodings)) { + if (_from_encodings != NULL && !*_from_encodings) { efree(_from_encodings); _from_encodings = NULL; } Index: ext/dba/dba.c =================================================================== --- ext/dba/dba.c (revision 290576) +++ ext/dba/dba.c (working copy) @@ -457,7 +457,7 @@ { dba_handler *hptr; - if (!strlen(new_value)) { + if (!*new_value) { DBA_G(default_hptr) = NULL; return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=50157&edit=1