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() --- fluid/Fl_Function_Type.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'fluid/Fl_Function_Type.cxx') diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index f6e8f5b29..54b4a7313 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include "Fl_Type.h" #include #include @@ -843,7 +844,7 @@ void Fl_Data_Type::open() { } // store the variable name: const char*c = data_input->value(); - char *s = strdup(c), *p = s, *q, *n; + char *s = fl_strdup(c), *p = s, *q, *n; for (;;++p) { if (!isspace((unsigned char)(*p))) break; } @@ -890,7 +891,7 @@ void Fl_Data_Type::open() { else if (!filename_ && *c) set_modflag(1); if (filename_) { free((void*)filename_); filename_ = 0L; } - if (c && *c) filename_ = strdup(c); + if (c && *c) filename_ = fl_strdup(c); // store the comment c = data_comment_input->buffer()->text(); if (c && *c) { @@ -1016,7 +1017,7 @@ Fl_Type *Fl_DeclBlock_Type::make() { Fl_DeclBlock_Type *o = new Fl_DeclBlock_Type(); o->name("#if 1"); o->public_ = 0; - o->after = strdup("#endif"); + o->after = fl_strdup("#endif"); o->add(p); o->factory = this; return o; @@ -1188,7 +1189,7 @@ void Fl_Comment_Type::open() { "Use forward slashes '/' to create submenus.", "My Comment"); if (xname) { - char *name = strdup(xname); + char *name = fl_strdup(xname); for (char*s=name;*s;s++) if (*s==':') *s = ';'; int n; Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments"); @@ -1305,7 +1306,7 @@ void Fl_Comment_Type::write_code1() { return; } // copy the comment line by line, add the double slash if needed - char *txt = strdup(c); + char *txt = fl_strdup(c); char *b = txt, *e = txt; for (;;) { // find the end of the line and set it to NUL @@ -1374,7 +1375,7 @@ int Fl_Class_Type::is_public() const {return public_;} void Fl_Class_Type::prefix(const char*p) { free((void*) class_prefix); - class_prefix=strdup(p ? p : "" ); + class_prefix=fl_strdup(p ? p : "" ); } Fl_Type *Fl_Class_Type::make() { @@ -1440,7 +1441,7 @@ void Fl_Class_Type::open() { else if (!w) Fl::wait(); } const char*c = c_name_input->value(); - char *s = strdup(c); + char *s = fl_strdup(c); size_t len = strlen(s); if (!*s) goto OOPS; p = (char*) (s+len-1); -- cgit v1.2.3