FLTK logo

[master] 91e8a02 - Remove useless 'if (...)'

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] 91e8a02 - Remove useless 'if (...)' "Albrecht Schlosser" Aug 05, 2020  
 
commit 91e8a0282ca92b05edd3761ccb9134156d00126a
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Wed Aug 5 14:34:45 2020 +0200
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Wed Aug 5 14:34:45 2020 +0200

    Remove useless 'if (...)'
    
    - dasharray_ can never be NULL unless if memory allocation failed
      previously
    - if dasharray_ was NULL, the previous strcmp() would have crashed
      anyway (but it can't be NULL, see above)

 src/drivers/SVG/Fl_SVG_File_Surface.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git src/drivers/SVG/Fl_SVG_File_Surface.cxx src/drivers/SVG/Fl_SVG_File_Surface.cxx
index 8f5c4ec..ae0172f 100644
--- src/drivers/SVG/Fl_SVG_File_Surface.cxx
+++ src/drivers/SVG/Fl_SVG_File_Surface.cxx
@@ -213,7 +213,7 @@ void Fl_SVG_Graphics_Driver::compute_dasharray(float s, char *dashes) {
   int dash_part = line_style_ & 0xFF;
   if (dash_part == FL_SOLID)  {
     if (strcmp(dasharray_, "none")) {
-      if (dasharray_) free(dasharray_);
+      free(dasharray_);
       dasharray_ = fl_strdup("none");
     }
   } else {
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'.