summaryrefslogtreecommitdiff
path: root/src/bin/psql/startup.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-09-12 08:31:56 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-09-12 08:45:03 +0200
commit5015e1e1b58f81a036e4ad16291ef4b3bb7a596c (patch)
tree86ee608e961dc830e733c534db089f1e45706414 /src/bin/psql/startup.c
parent2016055a92f26d648aba9f66d26cc0bcd1619eff (diff)
Assorted examples of expanded type-safer palloc/pg_malloc API
This adds some uses of the new palloc/pg_malloc variants here and there as a demonstration and test. This is kept separate from the actual API patch, since the latter might be backpatched at some point. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/bb755632-2a43-d523-36f8-a1e7a389a907@enterprisedb.com
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r--src/bin/psql/startup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index e2e5678e2d2..f5b9e268f20 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -247,8 +247,8 @@ main(int argc, char *argv[])
do
{
#define PARAMS_ARRAY_SIZE 8
- const char **keywords = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*keywords));
- const char **values = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*values));
+ const char **keywords = pg_malloc_array(const char *, PARAMS_ARRAY_SIZE);
+ const char **values = pg_malloc_array(const char *, PARAMS_ARRAY_SIZE);
keywords[0] = "host";
values[0] = options.host;
@@ -750,7 +750,7 @@ simple_action_list_append(SimpleActionList *list,
{
SimpleActionListCell *cell;
- cell = (SimpleActionListCell *) pg_malloc(sizeof(SimpleActionListCell));
+ cell = pg_malloc_object(SimpleActionListCell);
cell->next = NULL;
cell->action = action;