cli: drop _NMC_RL_STARTUPHOOK_ARGS

Fixes incompatible pointer types warning, which became an error in
newer compilers (e.g., https://bugs.gentoo.org/938249).

Modern libedit versions use the same type signature as readline for
rl_startup_hook, both declare

typedef int	 rl_hook_func_t(void)

This essentially reverts f47d55fc66 ("cli: Fix for rl_startup_hook
function signatures mismatch (-lreadline vs -ledit)").

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2082
This commit is contained in:
Florian Schmaus
2024-12-02 18:22:34 +01:00
committed by Lubomir Rintel
parent dd7252ff0c
commit 43bcfbcdf5
3 changed files with 3 additions and 11 deletions

View File

@@ -57,7 +57,7 @@ usage_agent_all(void)
static char *pre_input_deftext; static char *pre_input_deftext;
static int static int
set_deftext(_NMC_RL_STARTUPHOOK_ARGS) set_deftext(void)
{ {
if (pre_input_deftext && rl_startup_hook) { if (pre_input_deftext && rl_startup_hook) {
rl_insert_text(pre_input_deftext); rl_insert_text(pre_input_deftext);

View File

@@ -1138,7 +1138,7 @@ nmc_rl_gen_func_ifnames(const char *text, int state)
char *nmc_rl_pre_input_deftext; char *nmc_rl_pre_input_deftext;
int int
nmc_rl_set_deftext(_NMC_RL_STARTUPHOOK_ARGS) nmc_rl_set_deftext(void)
{ {
if (nmc_rl_pre_input_deftext && rl_startup_hook) { if (nmc_rl_pre_input_deftext && rl_startup_hook) {
rl_insert_text(nmc_rl_pre_input_deftext); rl_insert_text(nmc_rl_pre_input_deftext);

View File

@@ -50,17 +50,9 @@ char *nmc_rl_gen_func_ifnames(const char *text, int state);
gboolean nmc_get_in_readline(void); gboolean nmc_get_in_readline(void);
void nmc_set_in_readline(gboolean in_readline); void nmc_set_in_readline(gboolean in_readline);
#if HAVE_EDITLINE_READLINE
/* libedit has different signature for rl_startup_hook function */
#define _NMC_RL_STARTUPHOOK_ARGS const char *c, int i
#else
/* By default the libreadline shall be used */
#define _NMC_RL_STARTUPHOOK_ARGS void
#endif
/* for pre-filling a string to readline prompt */ /* for pre-filling a string to readline prompt */
extern char *nmc_rl_pre_input_deftext; extern char *nmc_rl_pre_input_deftext;
int nmc_rl_set_deftext(_NMC_RL_STARTUPHOOK_ARGS); int nmc_rl_set_deftext(void);
char *nmc_parse_lldp_capabilities(guint value); char *nmc_parse_lldp_capabilities(guint value);