diff options
| author | Greg Ercolano <erco@seriss.com> | 2020-07-21 20:15:41 -0700 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2020-08-01 14:19:40 -0700 |
| commit | 2141c63628a831d3f53dad7035c94028f8d0d629 (patch) | |
| tree | 614cb7b627da2decbb7cfe49c081f9d7b4140c58 /src/drivers/Xlib | |
| parent | 7514a73ba759f7fc9965eeef3b92ece899bd7a69 (diff) | |
Implement + deploy fl_strdup()
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx | 5 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx index 8b3784566..9251eafe4 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx @@ -20,6 +20,7 @@ #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/platform.H> +#include <FL/fl_string.h> #include "Fl_Font.H" #include <stdio.h> @@ -305,7 +306,7 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* xstarname) { if (fl_fonts[j].name && !strcmp(fl_fonts[j].name, p)) break; } else */{ j = fl_free_font++; - if (p == canon) p = strdup(p); else used_xlist = 1; + if (p == canon) p = fl_strdup(p); else used_xlist = 1; Fl::set_font((Fl_Font)j, p); break; } @@ -521,7 +522,7 @@ static char *put_font_size(const char *n, int size) const char *f; char *name; int nbf = 1; - name = strdup(n); + name = fl_strdup(n); while (name[i]) { if (name[i] == ',') {nbf++; name[i] = '\0';} i++; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx index 5a80904ab..6b42b880a 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx @@ -20,6 +20,7 @@ #include "Fl_Xlib_Graphics_Driver.H" #include <FL/Fl.H> #include <FL/fl_draw.H> +#include <FL/fl_string.h> // fl_strdup() #include <FL/platform.H> #include "Fl_Font.H" @@ -423,7 +424,7 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* pattern_name) } else { // The listed name has been modified - full_list[j] = strdup(first); + full_list[j] = fl_strdup(first); // Free the font name storage free (font); } @@ -451,7 +452,7 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* pattern_name) make_raw_name(xft_name, full_list[j]); // NOTE: This just adds on AFTER the default fonts - no attempt is made // to identify already loaded fonts. Is this bad? - stored_name = strdup(xft_name); + stored_name = fl_strdup(xft_name); Fl::set_font((Fl_Font)(j + FL_FREE_FONT), stored_name); fl_free_font ++; @@ -552,7 +553,7 @@ static XftFont* fontopen(const char* name, /*Fl_Fontsize*/double size, bool core } if(comma_count) { // multiple comma-separated names were passed - char *local_name = strdup(name); // duplicate the full name so we can edit the copy + char *local_name = fl_strdup(name); // duplicate the full name so we can edit the copy char *curr = local_name; // points to first name in string char *nxt; // next name in string do { @@ -681,7 +682,7 @@ static XftFont* fontopen(const char* name, /*Fl_Fontsize*/double size, bool core * XLFD's to construct a "super-pattern" that incorporates attributes from all * XLFD's and use that to perform a XftFontMatch(). Maybe... */ - char *local_name = strdup(name); + char *local_name = fl_strdup(name); if(comma_count) { // This means we were passed multiple XLFD's char *pc = strchr(local_name, ','); *pc = 0; // terminate the XLFD at the first comma @@ -1087,7 +1088,7 @@ static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) { const char *weight = wt_med; // no specifc weight requested - accept any char slant = 'r'; // regular non-italic by default char xlfd[128]; // we will put our synthetic XLFD in here - char *pc = strdup(fl_fonts[fnum].name); // what font were we asked for? + char *pc = fl_strdup(fl_fonts[fnum].name); // what font were we asked for? #if USE_PANGO char *p = pc + 1; while (*p) { *p = tolower(*p); p++; } |
