diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2013-10-13 00:09:18 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2013-10-13 00:09:18 -0400 |
commit | 5b6d08cd2992922b667564a49f19580f11676050 (patch) | |
tree | 4104a4255eeb88e78da71477b5f7b129f9a1b599 /src/bin/psql/input.c | |
parent | a53dee43fe585e673658b01e7354892dcede957e (diff) |
Add use of asprintf()
Add asprintf(), pg_asprintf(), and psprintf() to simplify string
allocation and composition. Replacement implementations taken from
NetBSD.
Reviewed-by: Álvaro Herrera <alvherre@2ndquadrant.com>
Reviewed-by: Asif Naeem <anaeem.it@gmail.com>
Diffstat (limited to 'src/bin/psql/input.c')
-rw-r--r-- | src/bin/psql/input.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index 07c9e89f368..f2b6e4ed7fa 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -298,11 +298,7 @@ initializeInput(int flags) if (histfile == NULL) { if (get_home_path(home)) - { - psql_history = pg_malloc(strlen(home) + 1 + - strlen(PSQLHISTORY) + 1); - snprintf(psql_history, MAXPGPATH, "%s/%s", home, PSQLHISTORY); - } + pg_asprintf(&psql_history, "%s/%s", home, PSQLHISTORY); } else { |