Skip to content

Commit 4b0e37f

Browse files
committed
Remove configure's check for rl_completion_append_character.
The comment for PGAC_READLINE_VARIABLES says "Readline versions < 2.1 don't have rl_completion_append_character". It seems certain that such versions are extinct in the wild, though; for sure there are none in the buildfarm. Libedit has had this variable for at least twenty years too. Also, tab-complete.c's behavior without it is quite unfriendly, since we'll emit a space even when completion fails; but we've had no complaints about that. Therefore, let's assume this variable is always there, and drop the configure check to save a few build cycles. Discussion: https://postgr.es/m/147685.1643858911@sss.pgh.pa.us
1 parent 9d179d9 commit 4b0e37f

File tree

5 files changed

+4
-74
lines changed

5 files changed

+4
-74
lines changed

config/programs.m4

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,11 @@ fi
211211

212212
# PGAC_READLINE_VARIABLES
213213
# -----------------------
214-
# Readline versions < 2.1 don't have rl_completion_append_character,
215-
# and some versions lack rl_completion_suppress_quote.
214+
# Some Readline versions lack rl_completion_suppress_quote.
216215
# Libedit lacks rl_filename_quote_characters and rl_filename_quoting_function
217216

218217
AC_DEFUN([PGAC_READLINE_VARIABLES],
219-
[AC_CACHE_CHECK([for rl_completion_append_character], pgac_cv_var_rl_completion_append_character,
220-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
221-
#if defined(HAVE_READLINE_READLINE_H)
222-
#include <readline/readline.h>
223-
#elif defined(HAVE_EDITLINE_READLINE_H)
224-
#include <editline/readline.h>
225-
#elif defined(HAVE_READLINE_H)
226-
#include <readline.h>
227-
#endif
228-
],
229-
[rl_completion_append_character = 'x';])],
230-
[pgac_cv_var_rl_completion_append_character=yes],
231-
[pgac_cv_var_rl_completion_append_character=no])])
232-
if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
233-
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
234-
[Define to 1 if you have the global variable 'rl_completion_append_character'.])
235-
fi
236-
AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
218+
[AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
237219
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
238220
#if defined(HAVE_READLINE_READLINE_H)
239221
#include <readline/readline.h>

configure

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17006,46 +17006,7 @@ fi
1700617006
LIBS="$LIBS_including_readline"
1700717007

1700817008
if test "$with_readline" = yes; then
17009-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_append_character" >&5
17010-
$as_echo_n "checking for rl_completion_append_character... " >&6; }
17011-
if ${pgac_cv_var_rl_completion_append_character+:} false; then :
17012-
$as_echo_n "(cached) " >&6
17013-
else
17014-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17015-
/* end confdefs.h. */
17016-
#include <stdio.h>
17017-
#if defined(HAVE_READLINE_READLINE_H)
17018-
#include <readline/readline.h>
17019-
#elif defined(HAVE_EDITLINE_READLINE_H)
17020-
#include <editline/readline.h>
17021-
#elif defined(HAVE_READLINE_H)
17022-
#include <readline.h>
17023-
#endif
17024-
17025-
int
17026-
main ()
17027-
{
17028-
rl_completion_append_character = 'x';
17029-
;
17030-
return 0;
17031-
}
17032-
_ACEOF
17033-
if ac_fn_c_try_link "$LINENO"; then :
17034-
pgac_cv_var_rl_completion_append_character=yes
17035-
else
17036-
pgac_cv_var_rl_completion_append_character=no
17037-
fi
17038-
rm -f core conftest.err conftest.$ac_objext \
17039-
conftest$ac_exeext conftest.$ac_ext
17040-
fi
17041-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_completion_append_character" >&5
17042-
$as_echo "$pgac_cv_var_rl_completion_append_character" >&6; }
17043-
if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
17044-
17045-
$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h
17046-
17047-
fi
17048-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
17009+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
1704917010
$as_echo_n "checking for rl_completion_suppress_quote... " >&6; }
1705017011
if ${pgac_cv_var_rl_completion_suppress_quote+:} false; then :
1705117012
$as_echo_n "(cached) " >&6

src/bin/psql/tab-complete.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,9 +1674,7 @@ psql_completion(const char *text, int start, int end)
16741674
completion_last_char = (end > start) ? text[end - start - 1] : '\0';
16751675

16761676
/* We usually want the append character to be a space. */
1677-
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
16781677
rl_completion_append_character = ' ';
1679-
#endif
16801678

16811679
/* Clear a few things. */
16821680
completion_charp = NULL;
@@ -4547,9 +4545,7 @@ psql_completion(const char *text, int start, int end)
45474545
{
45484546
COMPLETE_WITH_CONST(true, "");
45494547
/* Also, prevent Readline from appending stuff to the non-match */
4550-
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
45514548
rl_completion_append_character = '\0';
4552-
#endif
45534549
#ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
45544550
rl_completion_suppress_quote = 1;
45554551
#endif
@@ -5078,10 +5074,8 @@ _complete_from_query(const char *simple_query,
50785074
* space afterwards. Otherwise the schema will stop being part of the
50795075
* completion subject text, which is not what we want.
50805076
*/
5081-
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
50825077
if (num_schema_only > 0 && num_query_other == 0 && num_keywords == 0)
50835078
rl_completion_append_character = '\0';
5084-
#endif
50855079

50865080
/* No more matches, so free the result structure and return null */
50875081
PQclear(result);
@@ -5368,10 +5362,8 @@ complete_from_files(const char *text, int state)
53685362

53695363
Assert(*retend == '\'');
53705364
*retend = '/';
5371-
/* Try to prevent libedit from adding a space, too */
5372-
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
5365+
/* Prevent libedit from adding a space, too */
53735366
rl_completion_append_character = '\0';
5374-
#endif
53755367
}
53765368
}
53775369

src/include/pg_config.h.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,6 @@
460460
/* Define to 1 if you have the `readv' function. */
461461
#undef HAVE_READV
462462

463-
/* Define to 1 if you have the global variable
464-
'rl_completion_append_character'. */
465-
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
466-
467463
/* Define to 1 if you have the `rl_completion_matches' function. */
468464
#undef HAVE_RL_COMPLETION_MATCHES
469465

src/tools/msvc/Solution.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ sub GenerateFiles
347347
HAVE_READLINE_READLINE_H => undef,
348348
HAVE_READLINK => undef,
349349
HAVE_READV => undef,
350-
HAVE_RL_COMPLETION_APPEND_CHARACTER => undef,
351350
HAVE_RL_COMPLETION_MATCHES => undef,
352351
HAVE_RL_COMPLETION_SUPPRESS_QUOTE => undef,
353352
HAVE_RL_FILENAME_COMPLETION_FUNCTION => undef,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy