From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by bl2.djc.id.au (Postfix, from userid 1000) id 807EC29BBD7; Sat, 17 Oct 2026 11:24:59 +1100 (AEDT) Date: Sat, 17 Oct 2026 11:25:07 +1100 To: sup-commits@supmua.dev Subject: [ncursesw-ruby.git] 09/10: ensure definitions are only done once MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: Dan Callaghan In-Reply-To: <179219669847.381480.6906705364727468632@bl2.djc.id.au> References: <179219669847.381480.6906705364727468632@bl2.djc.id.au> Thread-Index: AQAAEjRW1ch74naHRnKg4xL7js+6AQ== X-Git-Host: bl2.djc.id.au X-Git-Repo: ncursesw-ruby.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: 07ac8c9b0b9c31b91e6c5192efdd79e96733a394 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.7.dev Auto-Submitted: auto-generated Message-Id: <20261017002459.807EC29BBD7@bl2.djc.id.au> From: Dan Callaghan List-Id: New commit on branch master: https://supmua.dev/git/ncursesw-ruby/commit/07ac8c9b0b9c31b91e6c5192efdd79e96733a394.html commit 07ac8c9b0b9c31b91e6c5192efdd79e96733a394 Author: Dan Callaghan AuthorDate: Sat Oct 10 18:12:30 2026 +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. --- ncurses_wrap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ncurses_wrap.c b/ncurses_wrap.c index 8ef2d2e..0773bc0 100644 --- 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; }