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 /src | |
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 'src')
-rw-r--r-- | src/css.cc | 2 | ||||
-rw-r--r-- | src/dialog.cc | 3 | ||||
-rw-r--r-- | src/form.cc | 3 | ||||
-rw-r--r-- | src/tipwin.cc | 9 |
4 files changed, 10 insertions, 7 deletions
@@ -91,7 +91,7 @@ void CssPropertyList::apply (CssPropertyList *props) { if (props->ownerOfStrings && (getRef (i)->type == CSS_TYPE_STRING || getRef (i)->type == CSS_TYPE_SYMBOL)) - value.strVal = strdup(value.strVal); + value.strVal = dStrdup(value.strVal); props->set ((CssPropertyName) getRef (i)->name, (CssValueType) getRef (i)->type, diff --git a/src/dialog.cc b/src/dialog.cc index 34928095..ac007315 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -32,6 +32,7 @@ #include "dialog.hh" #include "misc.h" #include "prefs.h" +#include "dlib/dlib.h" /* * Local Data @@ -190,7 +191,7 @@ const char *a_Dialog_input(const char *title, const char *msg) source = (char *)dList_nth_data(prefs.search_urls, i); if (!source || a_Misc_parse_search_url(source, &label, &url) < 0) continue; - pm[j++].label(FL_NORMAL_LABEL, strdup(label)); + pm[j++].label(FL_NORMAL_LABEL, dStrdup(label)); } } ch->tooltip("Select search engine"); diff --git a/src/form.cc b/src/form.cc index 8234c0a3..93bd4864 100644 --- a/src/form.cc +++ b/src/form.cc @@ -19,6 +19,7 @@ #include "dw/core.hh" #include "dw/textblock.hh" +#include "dlib/dlib.h" #include "misc.h" #include "msg.h" #include "prefs.h" @@ -829,7 +830,7 @@ void Html_tag_open_optgroup(DilloHtml *html, const char *tag, int tagsize) if (!label) { BUG_MSG("<optgroup> requires label attribute."); - label = strdup(""); + label = dStrdup(""); } DilloHtmlOptgroup *opt = diff --git a/src/tipwin.cc b/src/tipwin.cc index c2f37431..235e5f56 100644 --- a/src/tipwin.cc +++ b/src/tipwin.cc @@ -27,6 +27,7 @@ #include "prefs.h" #include "tipwin.hh" +#include "dlib/dlib.h" /* * Forward declarations @@ -132,7 +133,7 @@ TipWinButton::TipWinButton(int x, int y, int w, int h, const char *l) : Fl_Button(x, y, w, h, l) { tipwin = my_tipwin(); - mytooltip = strdup("empty"); + mytooltip = dStrdup("empty"); } TipWinButton::~TipWinButton(void) @@ -161,7 +162,7 @@ int TipWinButton::handle(int e) void TipWinButton::set_tooltip(const char *s) { free(mytooltip); - mytooltip = strdup(s); + mytooltip = dStrdup(s); } @@ -209,7 +210,7 @@ TipWinInput::TipWinInput (int x, int y, int w, int h, const char *l) : Fl_Input(x,y,w,h,l) { tipwin = my_tipwin(); - mytooltip = strdup("empty"); + mytooltip = dStrdup("empty"); } TipWinInput::~TipWinInput(void) @@ -239,6 +240,6 @@ int TipWinInput::handle(int e) void TipWinInput::set_tooltip(const char *s) { free(mytooltip); - mytooltip = strdup(s); + mytooltip = dStrdup(s); } |