From 43bcfbcdf5e255544adee3d02d0e98efa088c5d3 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 2 Dec 2024 18:22:34 +0100 Subject: [PATCH] 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 f47d55fc66bb ("cli: Fix for rl_startup_hook function signatures mismatch (-lreadline vs -ledit)"). https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2082 --- src/nmcli/agent.c | 2 +- src/nmcli/common.c | 2 +- src/nmcli/common.h | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/nmcli/agent.c b/src/nmcli/agent.c index b16a3c51c..478f3e688 100644 --- a/src/nmcli/agent.c +++ b/src/nmcli/agent.c @@ -57,7 +57,7 @@ usage_agent_all(void) static char *pre_input_deftext; static int -set_deftext(_NMC_RL_STARTUPHOOK_ARGS) +set_deftext(void) { if (pre_input_deftext && rl_startup_hook) { rl_insert_text(pre_input_deftext); diff --git a/src/nmcli/common.c b/src/nmcli/common.c index 2ced70f3a..15a7927bf 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -1138,7 +1138,7 @@ nmc_rl_gen_func_ifnames(const char *text, int state) char *nmc_rl_pre_input_deftext; int -nmc_rl_set_deftext(_NMC_RL_STARTUPHOOK_ARGS) +nmc_rl_set_deftext(void) { if (nmc_rl_pre_input_deftext && rl_startup_hook) { rl_insert_text(nmc_rl_pre_input_deftext); diff --git a/src/nmcli/common.h b/src/nmcli/common.h index 892b2d4e9..2ed130547 100644 --- a/src/nmcli/common.h +++ b/src/nmcli/common.h @@ -50,17 +50,9 @@ char *nmc_rl_gen_func_ifnames(const char *text, int state); gboolean nmc_get_in_readline(void); 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 */ 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);