diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-08-06 14:15:07 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-08-07 16:50:56 +0200 |
commit | f1b04c40ba9faf9b7b8969cf3686c35bb7b79b33 (patch) | |
tree | 9e37bde60e1aa7ee17bcd00fe77e5c48151ff224 /test/dw | |
parent | 83e88446c99f793f696984904e47070a287fd15d (diff) |
Use dStrdup instead of strdup
The strdup function is not available in POSIX-2001, so we use our own
implementation in dlib: dStrdup.
Reviewed-by: dogma
Diffstat (limited to 'test/dw')
-rw-r--r-- | test/dw/Makefile.am | 1 | ||||
-rw-r--r-- | test/dw/dw_anchors_test.cc | 3 | ||||
-rw-r--r-- | test/dw/form.cc | 11 |
3 files changed, 9 insertions, 6 deletions
diff --git a/test/dw/Makefile.am b/test/dw/Makefile.am index 39bb8440..d3aff074 100644 --- a/test/dw/Makefile.am +++ b/test/dw/Makefile.am @@ -10,6 +10,7 @@ LDADD = \ $(top_builddir)/dw/libDw-fltk.a \ $(top_builddir)/dw/libDw-core.a \ $(top_builddir)/lout/liblout.a \ + $(top_builddir)/dlib/libDlib.a \ @LIBFLTK_LIBS@ @LIBX11_LIBS@ check_PROGRAMS = \ diff --git a/test/dw/dw_anchors_test.cc b/test/dw/dw_anchors_test.cc index e88cecb6..258acc0e 100644 --- a/test/dw/dw_anchors_test.cc +++ b/test/dw/dw_anchors_test.cc @@ -24,6 +24,7 @@ #include <FL/Fl_Window.H> #include <FL/Fl.H> +#include "dlib/dlib.h" #include "dw/core.hh" #include "dw/fltkcore.hh" #include "dw/fltkviewport.hh" @@ -111,7 +112,7 @@ int main(int argc, char **argv) char buf[16]; strcpy (buf, numbers[i]); buf[0] = lout::misc::AsciiToupper (buf[0]); - buttonLabel[i] = strdup(buf); + buttonLabel[i] = dStrdup(buf); Fl_Button *button = new Fl_Button(0, 20 * i, 50, 20, buttonLabel[i]); button->callback (anchorCallback, (void*)(long)i); button->when (FL_WHEN_RELEASE); diff --git a/test/dw/form.cc b/test/dw/form.cc index 82938a16..93c65d39 100644 --- a/test/dw/form.cc +++ b/test/dw/form.cc @@ -20,6 +20,7 @@ #include "form.hh" +#include "dlib/dlib.h" namespace form { @@ -27,7 +28,7 @@ using namespace dw::core::ui; Form::ResourceDecorator::ResourceDecorator (const char *name) { - this->name = strdup (name); + this->name = dStrdup (name); } Form::ResourceDecorator::~ResourceDecorator () @@ -58,7 +59,7 @@ Form::RadioButtonResourceDecorator::RadioButtonResourceDecorator n++; this->values = new const char*[n + 1]; for (int i = 0; i < n; i++) - this->values[i] = strdup (values[i]); + this->values[i] = dStrdup (values[i]); this->values[n] = 0; } @@ -108,7 +109,7 @@ Form::SelectionResourceDecorator::SelectionResourceDecorator n++; this->values = new const char*[n + 1]; for(int i = 0; i < n; i++) - this->values[i] = strdup (values[i]); + this->values[i] = dStrdup (values[i]); this->values[n] = 0; } @@ -153,8 +154,8 @@ Form::FormClickedReceiver::FormClickedReceiver (Form *form, const char *name, const char *value) { this->form = form; - this->name = strdup (name); - this->value = strdup (value); + this->name = dStrdup (name); + this->value = dStrdup (value); } Form::FormClickedReceiver::~FormClickedReceiver () |