From 2141c63628a831d3f53dad7035c94028f8d0d629 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 21 Jul 2020 20:15:41 -0700 Subject: Implement + deploy fl_strdup() --- test/menubar.cxx | 3 ++- test/unittests.cxx | 3 ++- test/utf8.cxx | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/menubar.cxx b/test/menubar.cxx index 856aa72a1..43e4961ce 100644 --- a/test/menubar.cxx +++ b/test/menubar.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #define TERMINAL_HEIGHT 120 @@ -225,7 +226,7 @@ int main(int argc, char **argv) { for (int i=0; i<99; i++) { char buf[100]; sprintf(buf,"item %d",i); - hugemenu[i].text = strdup(buf); + hugemenu[i].text = fl_strdup(buf); } Fl_Double_Window window(WIDTH,400+TERMINAL_HEIGHT); G_tty = new Fl_Simple_Terminal(0,400,WIDTH,TERMINAL_HEIGHT); diff --git a/test/unittests.cxx b/test/unittests.cxx index 12b65fe2a..ca04aac62 100644 --- a/test/unittests.cxx +++ b/test/unittests.cxx @@ -28,6 +28,7 @@ #include #include #include // fl_text_extents() +#include // fl_strdup() // WINDOW/WIDGET SIZES #define MAINWIN_W 700 // main window w() @@ -53,7 +54,7 @@ public: UnitTest(const char *label, Fl_Widget* (*create)()) : fWidget(0L) { - fLabel = strdup(label); + fLabel = fl_strdup(label); fCreate = create; add(this); } diff --git a/test/utf8.cxx b/test/utf8.cxx index ed1dd1063..9151264f8 100644 --- a/test/utf8.cxx +++ b/test/utf8.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -620,10 +621,10 @@ int main(int argc, char** argv) sprintf(bu, "0x%06lX", y * 16); Fl_Input *b = new Fl_Input(200,(y-off)*25,80,25); b->textfont(FL_COURIER); - b->value(strdup(bu)); + b->value(fl_strdup(bu)); b = new Fl_Input(280,(y-off)*25,380,25); b->textfont(extra_font); - b->value(strdup(buf)); + b->value(fl_strdup(buf)); } scroll.end(); main_win->resizable(scroll); -- cgit v1.2.3