FLTK logo

[master] b409588 - Remove unneeded strdup from example, fold tabs

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] b409588 - Remove unneeded strdup from example, fold tabs "Greg Ercolano" Aug 01, 2020  
 
commit b4095880125b2f0d1d56c80a2bbf3fb0f6f98cb9
Author: Greg Ercolano <erco@seriss.com>
Date:   Tue Jul 21 23:57:45 2020 -0700

    Remove unneeded strdup from example, fold tabs

 examples/table-as-container.cxx                       | 4 ++--
 src/drivers/WinAPI/Fl_WinAPI_System_Driver.H          | 2 +-
 src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx        | 2 +-
 src/drivers/X11/Fl_X11_System_Driver.cxx              | 2 +-
 src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 2 +-
 src/fl_string.cxx                                     | 2 +-
 src/xutf8/utf8Wrap.c                                  | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git examples/table-as-container.cxx examples/table-as-container.cxx
index 838c555..d588743 100644
--- examples/table-as-container.cxx
+++ examples/table-as-container.cxx
@@ -31,7 +31,6 @@
 #include <FL/Fl_Input.H>
 #include <FL/fl_draw.H>
 #include <FL/Fl_Table.H>
-#include <FL/fl_string.h>	// fl_strdup()
 
 void button_cb(Fl_Widget *w, void*);
 
@@ -76,7 +75,8 @@ public:
           } else {
             // Create the light buttons
             sprintf(s, "%d/%d ", r, c);
-            Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H,fl_strdup(s));
+            Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H);
+            butt->copy_label(s);
             butt->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
             butt->callback(button_cb, (void*)0);
             butt->value( ((r+c*2) & 4 ) ? 1 : 0);
diff --git src/drivers/WinAPI/Fl_WinAPI_System_Driver.H src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index 049e6c1..0dd12ca 100644
--- src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -24,7 +24,7 @@
 
 #include "../../Fl_System_Driver.H"
 #include <stdarg.h>
-#include <string.h>	// strdup
+#include <string.h>  // strdup
 
 /*
  Move everything here that manages the system interface.
diff --git src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
index d37ec62..025d4ee 100644
--- src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
+++ src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
@@ -18,7 +18,7 @@
 #include "Fl_WinAPI_System_Driver.H"
 #include <FL/Fl.H>
 #include <FL/fl_utf8.h>
-#include <FL/fl_string.h>	// fl_strdup()
+#include <FL/fl_string.h>  // fl_strdup()
 #include <FL/filename.H>
 #include <FL/Fl_File_Browser.H>
 #include <FL/Fl_File_Icon.H>
diff --git src/drivers/X11/Fl_X11_System_Driver.cxx src/drivers/X11/Fl_X11_System_Driver.cxx
index 8a308bd..6dcaee0 100644
--- src/drivers/X11/Fl_X11_System_Driver.cxx
+++ src/drivers/X11/Fl_X11_System_Driver.cxx
@@ -17,7 +17,7 @@
 
 #include "Fl_X11_System_Driver.H"
 #include <FL/Fl_File_Browser.H>
-#include <FL/fl_string.h>	// fl_strdup
+#include <FL/fl_string.h>  // fl_strdup
 #include "../../flstring.h"
 
 #include <X11/Xlib.h>
diff --git src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
index 6b42b88..5c88ec1 100644
--- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
+++ src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
@@ -20,7 +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/fl_string.h>  // fl_strdup()
 #include <FL/platform.H>
 #include "Fl_Font.H"
 
diff --git src/fl_string.cxx src/fl_string.cxx
index cd0d084..c53c0e2 100644
--- src/fl_string.cxx
+++ src/fl_string.cxx
@@ -15,7 +15,7 @@
  */
 
 #include <FL/fl_string.h>
-#include <string.h>	// strdup/_strdup
+#include <string.h>  // strdup/_strdup
 #include "Fl_System_Driver.H"
 
 /**
diff --git src/xutf8/utf8Wrap.c src/xutf8/utf8Wrap.c
index a9f9bf9..4a2bbc9 100644
--- src/xutf8/utf8Wrap.c
+++ src/xutf8/utf8Wrap.c
@@ -21,7 +21,7 @@
 
 #include "../Xutf8.h"
 #include <X11/Xlib.h>
-#include <FL/fl_string.h>	// fl_strdup()
+#include <FL/fl_string.h>  // fl_strdup()
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.