aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-10-22 19:40:26 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-10-22 19:40:26 -0400
commit2c66f9924c1162bfba27c77004ccf42fb6ea188d (patch)
tree920c20776ef6d13d7a5d3a836202d897abcaf428 /src/bin/psql/command.c
parent09a89cb5fc29b47c26d151e82293fd3bef592b7b (diff)
downloadpostgresql-2c66f9924c1162bfba27c77004ccf42fb6ea188d.tar.gz
postgresql-2c66f9924c1162bfba27c77004ccf42fb6ea188d.zip
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.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 06ed56be683..0daac61e01c 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1188,7 +1188,7 @@ exec_command(const char *cmd,
/* Set variable to the value of the next argument */
char *newval;
- pg_asprintf(&newval, "%s=%s", envvar, envval);
+ newval = psprintf("%s=%s", envvar, envval);
putenv(newval);
success = true;
@@ -1549,7 +1549,7 @@ prompt_for_password(const char *username)
{
char *prompt_text;
- pg_asprintf(&prompt_text, _("Password for user %s: "), username);
+ prompt_text = psprintf(_("Password for user %s: "), username);
result = simple_prompt(prompt_text, 100, false);
free(prompt_text);
}
@@ -1929,17 +1929,17 @@ editFile(const char *fname, int lineno)
*/
#ifndef WIN32
if (lineno > 0)
- pg_asprintf(&sys, "exec %s %s%d '%s'",
+ sys = psprintf("exec %s %s%d '%s'",
editorName, editor_lineno_arg, lineno, fname);
else
- pg_asprintf(&sys, "exec %s '%s'",
+ sys = psprintf("exec %s '%s'",
editorName, fname);
#else
if (lineno > 0)
- pg_asprintf(&sys, SYSTEMQUOTE "\"%s\" %s%d \"%s\"" SYSTEMQUOTE,
+ sys = psprintf(SYSTEMQUOTE "\"%s\" %s%d \"%s\"" SYSTEMQUOTE,
editorName, editor_lineno_arg, lineno, fname);
else
- pg_asprintf(&sys, SYSTEMQUOTE "\"%s\" \"%s\"" SYSTEMQUOTE,
+ sys = psprintf(SYSTEMQUOTE "\"%s\" \"%s\"" SYSTEMQUOTE,
editorName, fname);
#endif
result = system(sys);
@@ -2635,9 +2635,9 @@ do_shell(const char *command)
/* See EDITOR handling comment for an explanation */
#ifndef WIN32
- pg_asprintf(&sys, "exec %s", shellName);
+ sys = psprintf("exec %s", shellName);
#else
- pg_asprintf(&sys, SYSTEMQUOTE "\"%s\"" SYSTEMQUOTE, shellName);
+ sys = psprintf(SYSTEMQUOTE "\"%s\"" SYSTEMQUOTE, shellName);
#endif
result = system(sys);
free(sys);