Content-Length: 316145 | pFad | http://github.com/postgrespro/postgres/commit/4b77bfc37a1819fdfd3b767a52ff633cd28f9155

0A psql: Reduce the amount of const lies a bit · postgrespro/postgres@4b77bfc · GitHub
Skip to content

Commit 4b77bfc

Browse files
committed
psql: Reduce the amount of const lies a bit
1 parent 88a6ac9 commit 4b77bfc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bin/psql/tab-complete.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,13 +3364,13 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
33643364
{
33653365
char **matches;
33663366
int overhead = strlen(prefix) + strlen(suffix) + 1;
3367-
const char **varnames;
3367+
char **varnames;
33683368
int nvars = 0;
33693369
int maxvars = 100;
33703370
int i;
33713371
struct _variable *ptr;
33723372

3373-
varnames = (const char **) pg_malloc((maxvars + 1) * sizeof(char *));
3373+
varnames = (char **) pg_malloc((maxvars + 1) * sizeof(char *));
33743374

33753375
for (ptr = pset.vars->next; ptr; ptr = ptr->next)
33763376
{
@@ -3379,8 +3379,8 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
33793379
if (nvars >= maxvars)
33803380
{
33813381
maxvars *= 2;
3382-
varnames = (const char **) realloc(varnames,
3383-
(maxvars + 1) * sizeof(char *));
3382+
varnames = (char **) realloc(varnames,
3383+
(maxvars + 1) * sizeof(char *));
33843384
if (!varnames)
33853385
{
33863386
psql_error("out of memory\n");
@@ -3394,10 +3394,10 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
33943394
}
33953395

33963396
varnames[nvars] = NULL;
3397-
COMPLETE_WITH_LIST(varnames);
3397+
COMPLETE_WITH_LIST((const char * const *) varnames);
33983398

33993399
for (i = 0; i < nvars; i++)
3400-
free((void *) varnames[i]);
3400+
free(varnames[i]);
34013401
free(varnames);
34023402

34033403
return matches;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/4b77bfc37a1819fdfd3b767a52ff633cd28f9155

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy