mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
psql: Reduce the amount of const lies a bit
This commit is contained in:
parent
88a6ac9f93
commit
4b77bfc37a
@ -3364,13 +3364,13 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
|
||||
{
|
||||
char **matches;
|
||||
int overhead = strlen(prefix) + strlen(suffix) + 1;
|
||||
const char **varnames;
|
||||
char **varnames;
|
||||
int nvars = 0;
|
||||
int maxvars = 100;
|
||||
int i;
|
||||
struct _variable *ptr;
|
||||
|
||||
varnames = (const char **) pg_malloc((maxvars + 1) * sizeof(char *));
|
||||
varnames = (char **) pg_malloc((maxvars + 1) * sizeof(char *));
|
||||
|
||||
for (ptr = pset.vars->next; ptr; ptr = ptr->next)
|
||||
{
|
||||
@ -3379,7 +3379,7 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
|
||||
if (nvars >= maxvars)
|
||||
{
|
||||
maxvars *= 2;
|
||||
varnames = (const char **) realloc(varnames,
|
||||
varnames = (char **) realloc(varnames,
|
||||
(maxvars + 1) * sizeof(char *));
|
||||
if (!varnames)
|
||||
{
|
||||
@ -3394,10 +3394,10 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
|
||||
}
|
||||
|
||||
varnames[nvars] = NULL;
|
||||
COMPLETE_WITH_LIST(varnames);
|
||||
COMPLETE_WITH_LIST((const char * const *) varnames);
|
||||
|
||||
for (i = 0; i < nvars; i++)
|
||||
free((void *) varnames[i]);
|
||||
free(varnames[i]);
|
||||
free(varnames);
|
||||
|
||||
return matches;
|
||||
|
Loading…
Reference in New Issue
Block a user