Skip to content

Commit

Permalink
use spprintf instead (no need to estrdup afterwards).
Browse files Browse the repository at this point in the history
  • Loading branch information
MiRacLe-RPZ authored and weltling committed Oct 18, 2015
1 parent 5c19355 commit 2b5af60
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ext/pdo_dblib/dblib_stmt.c
Expand Up @@ -205,15 +205,14 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
struct pdo_column_data *col = &stmt->columns[colno];

char *fname = (char*)dbcolname(H->link, colno+1);
char computed_buf[16];

if (fname && *fname) {
col->name = estrdup(fname);
col->namelen = strlen(col->name);
} else {
snprintf(computed_buf,16,"computed%d", colno);
col->name = estrdup(computed_buf);
col->namelen = spprintf(&col->name, NULL, "computed%d", colno);
}
col->maxlen = dbcollen(H->link, colno+1);
col->namelen = strlen(col->name);
col->param_type = PDO_PARAM_STR;

return 1;
Expand Down

0 comments on commit 2b5af60

Please sign in to comment.