Skip to content

Commit c19354d

Browse files
committed
const-ify functions used with completion_matches(), to suppress
cast-away-const warnings from compilers pickier than gcc.
1 parent 906dce0 commit c19354d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/bin/psql/tab-complete.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000-2002 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.75 2003/03/28 16:34:50 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.76 2003/04/03 20:18:16 tgl Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -67,7 +67,7 @@ extern char *filename_completion_function();
6767
#endif
6868

6969
#ifdef HAVE_RL_COMPLETION_MATCHES
70-
#define completion_matches(x, y) rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
70+
#define completion_matches rl_completion_matches
7171
#endif
7272

7373
#define BUF_SIZE 2048
@@ -76,12 +76,13 @@ extern char *filename_completion_function();
7676

7777
/* Forward declaration of functions */
7878
static char **psql_completion(char *text, int start, int end);
79-
static char *create_command_generator(char *text, int state);
80-
static char *complete_from_query(char *text, int state);
81-
static char *complete_from_schema_query(char *text, int state);
82-
static char *_complete_from_query(int is_schema_query, char *text, int state);
83-
static char *complete_from_const(char *text, int state);
84-
static char *complete_from_list(char *text, int state);
79+
static char *create_command_generator(const char *text, int state);
80+
static char *complete_from_query(const char *text, int state);
81+
static char *complete_from_schema_query(const char *text, int state);
82+
static char *_complete_from_query(int is_schema_query,
83+
const char *text, int state);
84+
static char *complete_from_const(const char *text, int state);
85+
static char *complete_from_list(const char *text, int state);
8586

8687
static PGresult *exec_query(char *query);
8788
char *quote_file_name(char *text, int match_type, char *quote_pointer);
@@ -1357,7 +1358,7 @@ psql_completion(char *text, int start, int end)
13571358
as defined above.
13581359
*/
13591360
static char *
1360-
create_command_generator(char *text, int state)
1361+
create_command_generator(const char *text, int state)
13611362
{
13621363
static int list_index,
13631364
string_length;
@@ -1383,13 +1384,13 @@ create_command_generator(char *text, int state)
13831384
/* The following two functions are wrappers for _complete_from_query */
13841385

13851386
static char *
1386-
complete_from_query(char *text, int state)
1387+
complete_from_query(const char *text, int state)
13871388
{
13881389
return _complete_from_query(0, text, state);
13891390
}
13901391

13911392
static char *
1392-
complete_from_schema_query(char *text, int state)
1393+
complete_from_schema_query(const char *text, int state)
13931394
{
13941395
return _complete_from_query(1, text, state);
13951396
}
@@ -1412,7 +1413,7 @@ complete_from_schema_query(char *text, int state)
14121413
*/
14131414

14141415
static char *
1415-
_complete_from_query(int is_schema_query, char *text, int state)
1416+
_complete_from_query(int is_schema_query, const char *text, int state)
14161417
{
14171418
static int list_index,
14181419
string_length;
@@ -1421,7 +1422,7 @@ _complete_from_query(int is_schema_query, char *text, int state)
14211422
const char *item;
14221423

14231424
/*
1424-
* If this ist the first time for this completion, we fetch a list of
1425+
* If this is the first time for this completion, we fetch a list of
14251426
* our "things" from the backend.
14261427
*/
14271428
if (state == 0)
@@ -1471,7 +1472,7 @@ _complete_from_query(int is_schema_query, char *text, int state)
14711472
SQL words that can appear at certain spot.
14721473
*/
14731474
static char *
1474-
complete_from_list(char *text, int state)
1475+
complete_from_list(const char *text, int state)
14751476
{
14761477
static int string_length,
14771478
list_index,
@@ -1531,7 +1532,7 @@ complete_from_list(char *text, int state)
15311532
The string to be passed must be in completion_charp.
15321533
*/
15331534
static char *
1534-
complete_from_const(char *text, int state)
1535+
complete_from_const(const char *text, int state)
15351536
{
15361537
(void) text; /* We don't care about what was entered
15371538
* already. */

0 commit comments

Comments
 (0)