mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
tree: replace some unnecessary uses of spprintf (#19354)
This commit is contained in:
parent
0596135d20
commit
d9000b3094
6 changed files with 34 additions and 38 deletions
|
@ -1383,14 +1383,14 @@ static void fpm_conf_cleanup(int which, void *arg) /* {{{ */
|
|||
|
||||
static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */
|
||||
{
|
||||
char *filename;
|
||||
int *error = (int *)arg;
|
||||
php_glob_t g;
|
||||
size_t i;
|
||||
|
||||
if (!inc || !arg) return;
|
||||
if (*error) return; /* We got already an error. Switch to the end. */
|
||||
spprintf(&filename, 0, "%s", ini_filename);
|
||||
|
||||
const char *filename = ini_filename;
|
||||
|
||||
{
|
||||
g.gl_offs = 0;
|
||||
|
@ -1398,31 +1398,26 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */
|
|||
#ifdef PHP_GLOB_NOMATCH
|
||||
if (i == PHP_GLOB_NOMATCH) {
|
||||
zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno);
|
||||
efree(filename);
|
||||
return;
|
||||
}
|
||||
#endif /* PHP_GLOB_NOMATCH */
|
||||
zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%zd) from %s at line %d.", inc, i, filename, ini_lineno);
|
||||
*error = 1;
|
||||
efree(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < g.gl_pathc; i++) {
|
||||
int len = strlen(g.gl_pathv[i]);
|
||||
size_t len = strlen(g.gl_pathv[i]);
|
||||
if (len < 1) continue;
|
||||
if (g.gl_pathv[i][len - 1] == '/') continue; /* don't parse directories */
|
||||
if (0 > fpm_conf_load_ini_file(g.gl_pathv[i])) {
|
||||
zlog(ZLOG_ERROR, "Unable to include %s from %s at line %d", g.gl_pathv[i], filename, ini_lineno);
|
||||
*error = 1;
|
||||
efree(filename);
|
||||
return;
|
||||
}
|
||||
}
|
||||
php_globfree(&g);
|
||||
}
|
||||
|
||||
efree(filename);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
|
|||
array_init(¶ms);
|
||||
|
||||
while (next) {
|
||||
char *buffered = NULL;
|
||||
zend_string *buffered = NULL;
|
||||
|
||||
switch (next->type) {
|
||||
case OP_PARAM:
|
||||
|
@ -125,28 +125,28 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
|
|||
break;
|
||||
|
||||
case METHOD_PARAM:
|
||||
spprintf(&buffered, 0, "%s::%s", next->method.class, next->method.name);
|
||||
add_next_index_string(¶ms, buffered);
|
||||
buffered = strpprintf(0, "%s::%s", next->method.class, next->method.name);
|
||||
add_next_index_str(¶ms, buffered);
|
||||
break;
|
||||
|
||||
case NUMERIC_METHOD_PARAM:
|
||||
spprintf(&buffered, 0, "%s::%s#"ZEND_LONG_FMT, next->method.class, next->method.name, next->num);
|
||||
add_next_index_string(¶ms, buffered);
|
||||
buffered = strpprintf(0, "%s::%s#"ZEND_LONG_FMT, next->method.class, next->method.name, next->num);
|
||||
add_next_index_str(¶ms, buffered);
|
||||
break;
|
||||
|
||||
case NUMERIC_FUNCTION_PARAM:
|
||||
spprintf(&buffered, 0, "%s#"ZEND_LONG_FMT, next->str, next->num);
|
||||
add_next_index_string(¶ms, buffered);
|
||||
buffered = strpprintf(0, "%s#"ZEND_LONG_FMT, next->str, next->num);
|
||||
add_next_index_str(¶ms, buffered);
|
||||
break;
|
||||
|
||||
case FILE_PARAM:
|
||||
spprintf(&buffered, 0, "%s:"ZEND_ULONG_FMT, next->file.name, next->file.line);
|
||||
add_next_index_string(¶ms, buffered);
|
||||
buffered = strpprintf(0, "%s:"ZEND_ULONG_FMT, next->file.name, next->file.line);
|
||||
add_next_index_str(¶ms, buffered);
|
||||
break;
|
||||
|
||||
case NUMERIC_FILE_PARAM:
|
||||
spprintf(&buffered, 0, "%s:#"ZEND_ULONG_FMT, next->file.name, next->file.line);
|
||||
add_next_index_string(¶ms, buffered);
|
||||
buffered = strpprintf(0, "%s:#"ZEND_ULONG_FMT, next->file.name, next->file.line);
|
||||
add_next_index_str(¶ms, buffered);
|
||||
break;
|
||||
|
||||
default: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue