From 60138ca8ec6039daa7c810f7e0c59c81cb8893fa Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Sat, 20 Aug 2022 21:16:43 -0400 Subject: [PATCH] (Facepalm) PDC_free_platform_dependent_memory() was completely stupid. We already have PDC_scr_free() for exactly that purpose. --- curspriv.h | 1 - docs/IMPLEMNT.md | 7 ------- dos/pdcscrn.c | 10 +++------- dosvga/pdcscrn.c | 4 ---- fb/pdcscrn.c | 4 ---- os2/pdcscrn.c | 10 +++------- pdcurses/initscr.c | 1 - plan9/pdcscrn.c | 4 ---- sdl1/pdcscrn.c | 4 ---- sdl2/pdcscrn.c | 4 ---- vt/pdcscrn.c | 4 ---- wincon/pdcscrn.c | 4 ---- wingui/pdcscrn.c | 4 ---- x11/pdcscrn.c | 4 ---- 14 files changed, 6 insertions(+), 59 deletions(-) diff --git a/curspriv.h b/curspriv.h index 58b34069..f99632c7 100644 --- a/curspriv.h +++ b/curspriv.h @@ -84,7 +84,6 @@ void PDC_scr_free(void); int PDC_scr_open(void); void PDC_set_keyboard_binary(bool); void PDC_transform_line(int, int, int, const chtype *); -void PDC_free_platform_dependent_memory( void); const char *PDC_sysname(void); /* Internal cross-module functions */ diff --git a/docs/IMPLEMNT.md b/docs/IMPLEMNT.md index 61207338..ddf56317 100644 --- a/docs/IMPLEMNT.md +++ b/docs/IMPLEMNT.md @@ -1,7 +1,6 @@ PDCurses Implementor's Guide ============================ - 2022/07/06 - added PDC_free_platform_dependent_memory() - Version 1.6 - 2019/09/?? - added PDC_doupdate(); removed argc, argv, lines, cols and SP allocation from PDC_scr_open(); removed PDC_init_pair(), @@ -246,12 +245,6 @@ the cursor to the lower left corner. (The X11 port does nothing.) Free any memory allocated by PDC_scr_open(). Called by delscreen(). -### void PDC_free_platform_dependent_memory( void); - -Free any platform-specific memory. Called by PDC_free_memory_allocations(). -Does nothing (at present) on all platforms except DOS and OS/2. On those, -it frees the initial screen state. - ### int PDC_scr_open(void); The platform-specific part of initscr(). It must initialize acs_map[] diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index 638e813e..5f7ddc19 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -477,6 +477,9 @@ void PDC_scr_close(void) void PDC_scr_free(void) { + if( saved_screen) + free(saved_screen); + saved_screen = NULL; } /* open the physical screen -- miscellaneous initialization, may save @@ -702,10 +705,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, INTENTIONALLY_UNUSED_PARAMETER( new_min_cols); INTENTIONALLY_UNUSED_PARAMETER( new_max_cols); } - -void PDC_free_platform_dependent_memory( void) -{ - if( saved_screen) - free(saved_screen); - saved_screen = NULL; -} diff --git a/dosvga/pdcscrn.c b/dosvga/pdcscrn.c index eff49baf..139aa888 100644 --- a/dosvga/pdcscrn.c +++ b/dosvga/pdcscrn.c @@ -1735,7 +1735,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/fb/pdcscrn.c b/fb/pdcscrn.c index 29790ebd..2fc6b716 100644 --- a/fb/pdcscrn.c +++ b/fb/pdcscrn.c @@ -394,7 +394,3 @@ int PDC_init_color( int color, int red, int green, int blue) } return OK; } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index d24824f7..73f02694 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -74,6 +74,9 @@ void PDC_scr_close(void) void PDC_scr_free(void) { + if( saved_screen) + free(saved_screen); + saved_screen = NULL; } /* open the physical screen -- miscellaneous initialization, may save @@ -226,10 +229,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, const int new_min_cols, const int new_max_cols) { } - -void PDC_free_platform_dependent_memory( void) -{ - if( saved_screen) - free(saved_screen); - saved_screen = NULL; -} diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 17b5d8a8..19cd28ba 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -336,7 +336,6 @@ bool isendwin(void) void PDC_free_memory_allocations( void) { - PDC_free_platform_dependent_memory( ); PDC_clearclipboard( ); traceoff( ); delscreen( SP); diff --git a/plan9/pdcscrn.c b/plan9/pdcscrn.c index 4804f800..7f2963a0 100644 --- a/plan9/pdcscrn.c +++ b/plan9/pdcscrn.c @@ -101,7 +101,3 @@ void PDC_scr_free(void) { free(SP); } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 384289eb..805cf847 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -357,7 +357,3 @@ void PDC_set_resize_limits( const int new_min_lines, INTENTIONALLY_UNUSED_PARAMETER( new_max_cols); return; } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index c87e649b..d406b9a2 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -494,7 +494,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, INTENTIONALLY_UNUSED_PARAMETER( new_min_cols); INTENTIONALLY_UNUSED_PARAMETER( new_max_cols); } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/vt/pdcscrn.c b/vt/pdcscrn.c index 705d1281..957659a1 100644 --- a/vt/pdcscrn.c +++ b/vt/pdcscrn.c @@ -384,7 +384,3 @@ int PDC_init_color( int color, int red, int green, int blue) curscr->_clear = TRUE; return OK; } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/wincon/pdcscrn.c b/wincon/pdcscrn.c index 59714105..a0510c7a 100644 --- a/wincon/pdcscrn.c +++ b/wincon/pdcscrn.c @@ -718,7 +718,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, INTENTIONALLY_UNUSED_PARAMETER( new_min_cols); INTENTIONALLY_UNUSED_PARAMETER( new_max_cols); } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/wingui/pdcscrn.c b/wingui/pdcscrn.c index 16c38e61..4468a85d 100644 --- a/wingui/pdcscrn.c +++ b/wingui/pdcscrn.c @@ -2338,7 +2338,3 @@ int PDC_init_color( int color, int red, int green, int blue) PDC_set_palette_entry( color, new_rgb); return OK; } - -void PDC_free_platform_dependent_memory( void) -{ -} diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 7630e4df..df8ba5de 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -827,7 +827,3 @@ void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines, PDC_min_cols = max( new_min_cols, 2); PDC_max_cols = max( new_max_cols, PDC_min_cols); } - -void PDC_free_platform_dependent_memory( void) -{ -}