1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

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
This commit is contained in:
Peter Eisentraut
2022-09-12 08:31:56 +02:00
parent 2016055a92
commit 5015e1e1b5
12 changed files with 90 additions and 111 deletions

View File

@@ -39,7 +39,7 @@ get_configdata(const char *my_exec_path, size_t *configdata_len)
/* Adjust this to match the number of items filled below */
*configdata_len = 23;
configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
configdata = palloc_array(ConfigData, *configdata_len);
configdata[i].name = pstrdup("BINDIR");
strlcpy(path, my_exec_path, sizeof(path));