mirror of
https://github.com/postgres/postgres.git
synced 2025-08-15 14:02:29 +03:00
Replace pg_asprintf() with psprintf().
This eliminates an awkward coding pattern that's also unnecessarily inconsistent with backend coding. psprintf() is now the thing to use everywhere.
This commit is contained in:
@@ -949,7 +949,7 @@ mkdatadir(const char *subdir)
|
||||
char *path;
|
||||
|
||||
if (subdir)
|
||||
pg_asprintf(&path, "%s/%s", pg_data, subdir);
|
||||
path = psprintf("%s/%s", pg_data, subdir);
|
||||
else
|
||||
path = pg_strdup(pg_data);
|
||||
|
||||
@@ -969,7 +969,7 @@ mkdatadir(const char *subdir)
|
||||
static void
|
||||
set_input(char **dest, char *filename)
|
||||
{
|
||||
pg_asprintf(dest, "%s/%s", share_path, filename);
|
||||
*dest = psprintf("%s/%s", share_path, filename);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1023,9 +1023,9 @@ write_version_file(char *extrapath)
|
||||
char *path;
|
||||
|
||||
if (extrapath == NULL)
|
||||
pg_asprintf(&path, "%s/PG_VERSION", pg_data);
|
||||
path = psprintf("%s/PG_VERSION", pg_data);
|
||||
else
|
||||
pg_asprintf(&path, "%s/%s/PG_VERSION", pg_data, extrapath);
|
||||
path = psprintf("%s/%s/PG_VERSION", pg_data, extrapath);
|
||||
|
||||
if ((version_file = fopen(path, PG_BINARY_W)) == NULL)
|
||||
{
|
||||
@@ -1053,7 +1053,7 @@ set_null_conf(void)
|
||||
FILE *conf_file;
|
||||
char *path;
|
||||
|
||||
pg_asprintf(&path, "%s/postgresql.conf", pg_data);
|
||||
path = psprintf("%s/postgresql.conf", pg_data);
|
||||
conf_file = fopen(path, PG_BINARY_W);
|
||||
if (conf_file == NULL)
|
||||
{
|
||||
@@ -2951,7 +2951,7 @@ setup_pgdata(void)
|
||||
* need quotes otherwise on Windows because paths there are most likely to
|
||||
* have embedded spaces.
|
||||
*/
|
||||
pg_asprintf(&pgdata_set_env, "PGDATA=%s", pg_data);
|
||||
pgdata_set_env = psprintf("PGDATA=%s", pg_data);
|
||||
putenv(pgdata_set_env);
|
||||
}
|
||||
|
||||
@@ -3345,7 +3345,7 @@ create_xlog_symlink(void)
|
||||
}
|
||||
|
||||
/* form name of the place where the symlink must go */
|
||||
pg_asprintf(&linkloc, "%s/pg_xlog", pg_data);
|
||||
linkloc = psprintf("%s/pg_xlog", pg_data);
|
||||
|
||||
#ifdef HAVE_SYMLINK
|
||||
if (symlink(xlog_dir, linkloc) != 0)
|
||||
|
Reference in New Issue
Block a user