From 97b9891f11a3efd4ad72d84cf12cd26ca7b428a1 Mon Sep 17 00:00:00 2001 From: uwe Date: Tue, 14 May 2024 10:22:48 +0000 Subject: [PATCH] curse: constify define_key() argument define_key() is ncurses extension and ncurses defines its first argument as "const char *". Follow suit. PR lib/58254 --- lib/libcurses/curses.h | 4 ++-- lib/libcurses/curses_input.3 | 4 ++-- lib/libcurses/getch.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 165216df0cae..20328636dff6 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $NetBSD: curses.h,v 1.130 2021/02/13 10:37:00 rillig Exp $ */ +/* $NetBSD: curses.h,v 1.131 2024/05/14 10:22:48 uwe Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -652,7 +652,7 @@ int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int); int curs_set(int); int def_prog_mode(void); int def_shell_mode(void); -int define_key(char *, int); +int define_key(const char *, int); int delay_output(int); void delscreen(SCREEN *); int delwin(WINDOW *); diff --git a/lib/libcurses/curses_input.3 b/lib/libcurses/curses_input.3 index b7011cab273a..c344ac263d62 100644 --- a/lib/libcurses/curses_input.3 +++ b/lib/libcurses/curses_input.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: curses_input.3,v 1.30 2022/05/21 12:34:44 uwe Exp $ +.\" $NetBSD: curses_input.3,v 1.31 2024/05/14 10:22:48 uwe Exp $ .\" .\" Copyright (c) 2002 .\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) @@ -76,7 +76,7 @@ .Ft int .Fn has_key "int key_symbol" .Ft int -.Fn define_key "char *sequence" "int key_symbol" +.Fn define_key "const char *sequence" "int key_symbol" .Ft int .Fn getnstr "char *str" "int limit" .Ft int diff --git a/lib/libcurses/getch.c b/lib/libcurses/getch.c index fb120eaffb95..8b4e5a88e0ec 100644 --- a/lib/libcurses/getch.c +++ b/lib/libcurses/getch.c @@ -1,4 +1,4 @@ -/* $NetBSD: getch.c,v 1.78 2021/10/19 06:37:29 blymn Exp $ */ +/* $NetBSD: getch.c,v 1.79 2024/05/14 10:22:48 uwe Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: getch.c,v 1.78 2021/10/19 06:37:29 blymn Exp $"); +__RCSID("$NetBSD: getch.c,v 1.79 2024/05/14 10:22:48 uwe Exp $"); #endif #endif /* not lint */ @@ -211,7 +211,7 @@ static wchar_t inbuf[INBUF_SZ]; static int start, end, working; /* pointers for manipulating inbuf data */ /* prototypes for private functions */ -static void add_key_sequence(SCREEN *screen, char *sequence, int key_type); +static void add_key_sequence(SCREEN *screen, const char *sequence, int key_type); static key_entry_t *add_new_key(keymap_t *current, char ch, int key_type, int symbol); static void delete_key_sequence(keymap_t *current, int key_type); @@ -370,7 +370,7 @@ delete_key_sequence(keymap_t *current, int key_type) * for the given key symbol. */ static void -add_key_sequence(SCREEN *screen, char *sequence, int key_type) +add_key_sequence(SCREEN *screen, const char *sequence, int key_type) { key_entry_t *tmp_key; keymap_t *current; @@ -762,7 +762,7 @@ do_keyok(keymap_t *current, int key_type, bool set, bool flag, int *retval) * */ int -define_key(char *sequence, int symbol) +define_key(const char *sequence, int symbol) { if (symbol <= 0 || _cursesi_screen == NULL)