sup

A curses threads-with-tags style email client

ncursesw-ruby.git

git clone https://supmua.dev/git/ncursesw-ruby/
commit 07ac8c9b0b9c31b91e6c5192efdd79e96733a394
parent ab7ef7466ce78093d4c97ae014c3d345dc71ac99
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sat, 10 Oct 2026 18:12:30 +1100

ensure definitions are only done once

Init_ncurses_full() is called from a number of places, which may happen
multiple times after the module is initially require'd. In this case it
would produce a huge number of "method redefined" warnings, for example
in Sup's test suite now that there is a call to Ncurses.new_term.

Diffstat:
M ncurses_wrap.c | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -2896,6 +2896,9 @@ void Init_ncursesw_bin(void)
 }
 static void Init_ncurses_full(void)
 {
+    static bool already_done = false;
+    if (already_done) return;
+
     init_globals_1();
     init_globals_2();
     init_functions_0();
@@ -2913,4 +2916,6 @@ static void Init_ncurses_full(void)
 #if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
     init_menu();
 #endif
+
+    already_done = true;
 }