[genius] Tue Oct 27 00:01:47 2020 Jiri (George) Lebl <jirka 5z com>



commit 6cb2fa4961ad6de99b5e8a83b5a8999baa30c650
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Tue Oct 27 00:02:01 2020 -0700

    Tue Oct 27 00:01:47 2020  Jiri (George) Lebl <jirka 5z com>
    
            * src/*.[ch], ve/*.c, gtkextra/*.[ch]: Fix bunch of warnings, some of
              them fixing possible crashes

 ChangeLog                         |   5 ++
 configure.ac                      |   3 +
 gtkextra/gtkextra.c               |   2 +-
 gtkextra/gtkplot.c                |  32 ++++++++--
 gtkextra/gtkplot3d.c              |  65 +++++++++++++-------
 gtkextra/gtkplotarray.c           |   2 +
 gtkextra/gtkplotbar.c             |   4 ++
 gtkextra/gtkplotbox.c             |  11 +++-
 gtkextra/gtkplotcairo.c           |  15 +++--
 gtkextra/gtkplotcandle.c          |   2 +-
 gtkextra/gtkplotcanvas.c          |  11 +++-
 gtkextra/gtkplotcanvasellipse.c   |   4 ++
 gtkextra/gtkplotcanvasline.c      |   8 +++
 gtkextra/gtkplotcanvaspixmap.c    |   4 ++
 gtkextra/gtkplotcanvasplot.c      |  10 ++--
 gtkextra/gtkplotcanvasrectangle.c |   4 ++
 gtkextra/gtkplotcanvastext.c      |   4 ++
 gtkextra/gtkplotcsurface.c        |  24 +++++---
 gtkextra/gtkplotdata.c            |  30 +++++++---
 gtkextra/gtkplotdt.c              |   4 ++
 gtkextra/gtkplotflux.c            |   7 ++-
 gtkextra/gtkplotpixmap.c          |   4 ++
 gtkextra/gtkplotpolar.c           |   4 ++
 gtkextra/gtkplotps.c              |   4 +-
 gtkextra/gtkplotsurface.c         |   6 +-
 gtkextra/gtkpsfont.c              |   6 +-
 src/calc.c                        |  29 ++++-----
 src/calc.h                        |   2 +-
 src/eval.c                        | 122 +++++++++++++++++++++-----------------
 src/funclib.c                     |  12 ++--
 src/graphing.c                    |  14 ++---
 src/lexer.l                       |   4 +-
 src/matop.c                       |   6 +-
 src/matrixw.c                     |  17 +-----
 src/matrixw.h                     |  54 ++++-------------
 src/mpwrap.c                      |  75 ++++++++++++-----------
 src/parse.y                       |   2 +-
 src/plugin.c                      |   3 +-
 src/structs.h                     |   4 +-
 ve/ve-config.c                    |  10 ++--
 40 files changed, 375 insertions(+), 254 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 034074ee..2946df71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 27 00:01:47 2020  Jiri (George) Lebl <jirka 5z com>
+
+       * src/*.[ch], ve/*.c, gtkextra/*.[ch]: Fix bunch of warnings, some of
+         them fixing possible crashes
+
 Mon Oct 26 18:35:24 2020  Jiri (George) Lebl <jirka 5z com>
 
        * src/graphing.c: reset minx/maxx for fitted parametric plots
diff --git a/configure.ac b/configure.ac
index 0009eea3..68e625ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,9 @@ AM_BINRELOC
 
 AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS])
 
+dnl remove stupid warning
+WARN_CFLAGS=`echo $WARN_CFLAGS | sed 's/ -Wswitch-enum / /'`
+
 dnl ================= Translation Stuff ==============================================
 
 GETTEXT_PACKAGE=genius
diff --git a/gtkextra/gtkextra.c b/gtkextra/gtkextra.c
index 3f0ce989..68ca8d70 100644
--- a/gtkextra/gtkextra.c
+++ b/gtkextra/gtkextra.c
@@ -98,7 +98,7 @@ _gtkextra_signal_emit(GObject *object, guint signal_id, ...)
 
   g_signal_query(signal_id, &query);
 
-  for (i = 0; i < query.n_params; i++)
+  for (i = 0; i < (int)query.n_params; i++)
     {
       gboolean static_scope = query.param_types[i]&~G_SIGNAL_TYPE_STATIC_SCOPE;
       g_value_init(instance_and_params + i + 1, query.param_types[i]);
diff --git a/gtkextra/gtkplot.c b/gtkextra/gtkplot.c
index fe8fa511..0306e46c 100644
--- a/gtkextra/gtkplot.c
+++ b/gtkextra/gtkplot.c
@@ -2005,6 +2005,8 @@ gtk_plot_set_property (GObject      *object,
     case ARG_LEGENDS_TRANSPARENT:
       plot->legends_attr.transparent = g_value_get_boolean(value);
       break;
+    default:
+      break;
   }
 }
 
@@ -2279,6 +2281,8 @@ gtk_plot_axis_set_property (GObject      *object,
       else
         gtk_plot_axis_set_tick_labels(axis, NULL);
       break;
+    default:
+      break;
   }
 }
 
@@ -2813,6 +2817,8 @@ gtk_plot_axis_construct(GtkPlotAxis *axis, GtkPlotOrientation orientation)
      axis->title.text = g_strdup("Z Title");
      axis->title.angle = 0;
      break;
+   default:
+     break;
   }
 }
 
@@ -3241,6 +3247,8 @@ gtk_plot_draw_labels(GtkPlot *plot,
            break;
     case 270:
            break;
+    default:
+          break;
   }
 
   if(axis->ticks.values) {
@@ -3686,6 +3694,8 @@ gtk_plot_ticks_inverse(GtkPlotAxis *axis, gdouble x)
             point = exp(point); 
         }
         break;
+      default:
+       break;
     }
     return point;
 }
@@ -4018,7 +4028,7 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
        case 'b':
           if(lastchar){
              const gchar *aux2 = lastchar;
-             gint i = g_utf8_next_char(aux) - aux2;
+             i = g_utf8_next_char(aux) - aux2;
              pango_layout_set_text(layout, lastchar, i);
              pango_layout_get_extents(layout, NULL, &rect);
              x -= PANGO_PIXELS(rect.width);
@@ -4059,7 +4069,7 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
        default:
            if(aux && *aux != '\0' && *aux !='\n'){
              const gchar *aux2 = aux;
-             gint i = g_utf8_next_char(aux) - aux2;
+             i = g_utf8_next_char(aux) - aux2;
              pango_layout_set_font_description(layout, font);
              pango_layout_set_text(layout, aux, i);
              pango_layout_get_extents(layout, NULL, &rect);
@@ -4072,7 +4082,7 @@ gtk_plot_text_get_size(const gchar *text, gint angle,
    } else {
      if(aux && *aux != '\0' && *aux != '\n'){
        const gchar *aux2 = aux;
-       gint i = g_utf8_next_char(aux) - aux2;
+       i = g_utf8_next_char(aux) - aux2;
        pango_layout_set_font_description(layout, font);
        pango_layout_set_text(layout, aux, i);
        pango_layout_get_extents(layout, NULL, &rect);
@@ -4146,6 +4156,8 @@ gtk_plot_text_get_area(const gchar *text, gint angle, GtkJustification just,
         case 270:
             *x -= descent;
             break;
+       default:
+           break;
       }
       break;
     case GTK_JUSTIFY_RIGHT:
@@ -4164,6 +4176,8 @@ gtk_plot_text_get_area(const gchar *text, gint angle, GtkJustification just,
             *y -= *height;
             *x -= descent; 
             break;
+       default:
+           break;
       }
       break;
     case GTK_JUSTIFY_CENTER:
@@ -4185,6 +4199,8 @@ gtk_plot_text_get_area(const gchar *text, gint angle, GtkJustification just,
             *x -= descent;
             *y -= *height / 2.;
             break;
+       default:
+           break;
       }
   }
 
@@ -5257,6 +5273,8 @@ gtk_plot_get_axis (GtkPlot *plot, GtkPlotAxisPos axis)
     case GTK_PLOT_AXIS_BOTTOM:
          aux = plot->bottom;
          break;
+    default:
+        break;
   }
   return aux; 
 }
@@ -6497,7 +6515,7 @@ printf("%f %f\n",max/ticks->step,ceil(max/ticks->step));
   if(scale == GTK_PLOT_SCALE_LOG10){
     min = ticks->min;
     max = ticks->max;
-    if(max <= 0.0f) ticks->max = max = 1.E-11;
+    if(max <= (double)0.0f) ticks->max = max = 1.E-11;
     if(max <= 0) ticks->max = max = fabs(max);
     if(min <= 0) ticks->min = min = max / 100.;
     min = floor(log10(min));
@@ -6551,6 +6569,8 @@ printf("%f %f\n",max/ticks->step,ceil(max/ticks->step));
         case GTK_PLOT_SCALE_LOG10:
             tick = tick_step * pow(10., n*major_step); 
             break;
+       default:
+           break;
      }
      /* FIXME: hard bailout limit in case something is totally off
       * to avoid locking up */
@@ -6588,6 +6608,8 @@ printf("%f %f\n",max/ticks->step,ceil(max/ticks->step));
           tick_step = major[nmajor-1].value;
         tick = tick_step;
         break;
+      default:
+       break;
     }
     for(i = 0; i < ticks->nminor; i++){
      switch(scale){
@@ -6602,6 +6624,8 @@ printf("%f %f\n",max/ticks->step,ceil(max/ticks->step));
             * tick += tick_step; */
             tick = tick_step + i * tick_step;
             break;
+       default:
+           break;
      }   
      if(tick >= absmin-major_step*1.E-2 && tick <= absmax+major_step*1.E-2){
         n++;
diff --git a/gtkextra/gtkplot3d.c b/gtkextra/gtkplot3d.c
index e04369df..a2e392aa 100644
--- a/gtkextra/gtkplot3d.c
+++ b/gtkextra/gtkplot3d.c
@@ -1436,7 +1436,7 @@ gtk_plot3d_real_paint (GtkWidget *widget)
   gint width, height;
   gint xoffset, yoffset;
   gint origin;
-  gdouble pz;
+  gdouble px, py, pz;
   GtkPlotVector e[8], o, v[8];
   GtkPlotVector vx, vy, vz;
   gint i;
@@ -1695,7 +1695,6 @@ gtk_plot3d_real_paint (GtkWidget *widget)
 
   if(plot->corner_visible){
     gdouble px0, py0, pz0;
-    gdouble px, py, pz;
     gint corner;
     gint end[3];
     
@@ -1893,6 +1892,8 @@ gtk_plot3d_draw_grids(GtkPlot3D *plot, GtkPlotAxis *axis, GtkPlotVector delta)
       major_grid = GTK_PLOT(plot)->top->major_grid;
       minor_grid = GTK_PLOT(plot)->top->minor_grid;
       break;
+    default:
+      break;
   }
 
   if(axis->show_minor_grid)
@@ -2060,6 +2061,8 @@ gtk_plot3d_draw_labels(GtkPlot3D *plot,
            break;
     case 270:
            break;
+    default:
+          break;
   }
 
   tick = axis->labels_attr;
@@ -2894,7 +2897,8 @@ gtk_plot3d_show_labels     (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->label_mask = label_mask;
+  if (axis != NULL)
+         axis->label_mask = label_mask;
 }
 
 /**
@@ -2912,7 +2916,8 @@ gtk_plot3d_show_title     (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->title_visible = TRUE;
+  if (axis != NULL)
+         axis->title_visible = TRUE;
 }
 
 /**
@@ -2930,7 +2935,8 @@ gtk_plot3d_hide_title     (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->title_visible = FALSE;
+  if (axis != NULL)
+         axis->title_visible = FALSE;
 }
 
 
@@ -2951,7 +2957,8 @@ gtk_plot3d_show_major_ticks (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->major_mask = ticks_mask;
+  if (axis != NULL)
+         axis->major_mask = ticks_mask;
 }
 
 /**
@@ -2971,7 +2978,8 @@ gtk_plot3d_show_minor_ticks(GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->minor_mask = ticks_mask;
+  if (axis != NULL)
+         axis->minor_mask = ticks_mask;
 }
 
 /**
@@ -2993,9 +3001,10 @@ gtk_plot3d_set_ticks        (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_axis(plot, direction);
 
-  axis->ticks.step = major_step;
-
-  axis->ticks.nminor = nminor;
+  if (axis != NULL) {
+         axis->ticks.step = major_step;
+         axis->ticks.nminor = nminor;
+  }
 }
 
 /**
@@ -3015,7 +3024,8 @@ gtk_plot3d_set_major_ticks  (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_axis(plot, direction);
 
-  axis->ticks.step = major_step;
+  if (axis != NULL)
+         axis->ticks.step = major_step;
 }
 
 /**
@@ -3035,7 +3045,8 @@ gtk_plot3d_set_minor_ticks  (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_axis(plot, direction);
 
-  axis->ticks.nminor = nminor;
+  if (axis != NULL)
+         axis->ticks.nminor = nminor;
 }
 
 /**
@@ -3055,7 +3066,8 @@ gtk_plot3d_set_ticks_length  (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_axis(plot, direction);
 
-  axis->ticks_length = length;
+  if (axis != NULL)
+         axis->ticks_length = length;
 }
 
 /**
@@ -3075,7 +3087,8 @@ gtk_plot3d_set_ticks_width   (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_axis(plot, direction);
 
-  axis->ticks_width = width;
+  if (axis != NULL)
+         axis->ticks_width = width;
 }
 
 /**
@@ -3097,8 +3110,10 @@ gtk_plot3d_show_ticks        (GtkPlot3D *plot,
 
   axis = gtk_plot3d_get_side(plot, side);
 
-  axis->major_mask = major_mask;
-  axis->minor_mask = minor_mask;
+  if (axis != NULL) {
+         axis->major_mask = major_mask;
+         axis->minor_mask = minor_mask;
+  }
 }
 
 /**
@@ -3534,9 +3549,12 @@ gtk_plot3d_set_scale       (GtkPlot3D *plot,
                             GtkPlotOrientation axis,
                             GtkPlotScale scale)
 {
-  GtkPlotAxis *ax;
-  ax = gtk_plot3d_get_axis(plot, axis);
-  ax->ticks.scale = scale;
+       GtkPlotAxis *ax;
+       ax = gtk_plot3d_get_axis(plot, axis);
+
+       if (ax != NULL) {
+               ax->ticks.scale = scale;
+       }
 }
 
 /**
@@ -3553,7 +3571,10 @@ GtkPlotScale
 gtk_plot3d_get_scale       (GtkPlot3D *plot,
                             GtkPlotOrientation axis)
 {
-  GtkPlotAxis *ax;
-  ax = gtk_plot3d_get_axis(plot, axis);
-  return(ax->ticks.scale);
+       GtkPlotAxis *ax;
+       ax = gtk_plot3d_get_axis(plot, axis);
+       if G_LIKELY (ax != NULL)
+               return ax->ticks.scale;
+       else 
+               return GTK_PLOT_SCALE_LINEAR;
 }
diff --git a/gtkextra/gtkplotarray.c b/gtkextra/gtkplotarray.c
index 5bc1174b..b2d12bb5 100644
--- a/gtkextra/gtkplotarray.c
+++ b/gtkextra/gtkplotarray.c
@@ -219,6 +219,8 @@ gtk_plot_array_set_property (GObject      *object,
       case PROP_DATA:
         data->data = *((GtkPlotArrayArg *)g_value_get_pointer(value));
         break;
+      default:
+       break;
     }
 }
 
diff --git a/gtkextra/gtkplotbar.c b/gtkextra/gtkplotbar.c
index d40de168..8acdac86 100644
--- a/gtkextra/gtkplotbar.c
+++ b/gtkextra/gtkplotbar.c
@@ -145,6 +145,8 @@ gtk_plot_bar_set_property (GObject      *object,
       case ARG_ORIENTATION:
         data->orientation  = g_value_get_enum(value);
         break;
+      default:
+       break;
     }
 }
 
@@ -280,6 +282,8 @@ gtk_plot_bar_draw_symbol(GtkPlotData *dataset,
         if(dataset->show_xerrbars)
           gtk_plot_get_pixel(plot, y + dy, x, &ex, &ey);
         break;
+      default:
+       break;
     }
     x1 = MIN(px, px0);
     y1 = MIN(py, py0);
diff --git a/gtkextra/gtkplotbox.c b/gtkextra/gtkplotbox.c
index c64410bd..0c8e5348 100644
--- a/gtkextra/gtkplotbox.c
+++ b/gtkextra/gtkplotbox.c
@@ -135,6 +135,8 @@ gtk_plot_box_set_property (GObject      *object,
       case ARG_ORIENTATION:
         data->orientation  = g_value_get_enum(value);
         break;
+      default:
+       break;
     }
 }
 
@@ -260,7 +262,7 @@ gtk_plot_box_draw_symbol(GtkPlotData *dataset,
             gtk_plot_get_pixel(plot, x, y, &px0, &py0);
             gtk_plot_get_pixel(plot, x, z, &px1, &py1);
             width = roundint(dataset->symbol.size * m);
-            height = abs(py1 - py0);
+            height = fabs(py1 - py0);
 
             gtk_plot_get_pixel(plot, x, z + dy, &eu_x, &eu_y);
             gtk_plot_get_pixel(plot, x, y - dy, &ed_x, &ed_y);
@@ -324,6 +326,9 @@ gtk_plot_box_draw_symbol(GtkPlotData *dataset,
             gtk_plot_pc_draw_lines(plot->pc, errbar, 2);
 
             break;
+
+         default:
+           break;
         }
       }
 
@@ -346,6 +351,8 @@ gtk_plot_box_draw_symbol(GtkPlotData *dataset,
           height = roundint(dataset->symbol.size * m);
           y1 = py0 - height / 2;
           break;
+       default:
+         break;
       }
 
       if(dataset->symbol.symbol_style == GTK_PLOT_SYMBOL_OPAQUE){
@@ -374,6 +381,8 @@ gtk_plot_box_draw_symbol(GtkPlotData *dataset,
         case GTK_ORIENTATION_HORIZONTAL:    
           gtk_plot_pc_draw_line(plot->pc, px, py-height/2, px, py+height/2); 
           break;
+       default:
+         break;
       }
 
     }  
diff --git a/gtkextra/gtkplotcairo.c b/gtkextra/gtkplotcairo.c
index 63357ec9..4a27c2aa 100644
--- a/gtkextra/gtkplotcairo.c
+++ b/gtkextra/gtkplotcairo.c
@@ -409,9 +409,9 @@ gtk_plot_cairo_set_dash                               (GtkPlotPC *pc,
                                                        gint num_values)
 {
   cairo_t *cairo = GTK_PLOT_CAIRO(pc)->cairo; /* Shortcut */
+  gchar list[] = {'\0','\1','\2','\3','\4','\5','\6','\7'};
   if (!cairo)
     return;
-  gchar list[] = {'\0','\1','\2','\3','\4','\5','\6','\7'};
   double dash[1000];
   gint i;
 
@@ -781,6 +781,8 @@ gtk_plot_cairo_draw_string                        (GtkPlotPC *pc,
         case 270:
             tx -= descent;
             break;
+       default:
+           break;
       }
       old_tx = tx;
       old_ty = ty;
@@ -808,6 +810,8 @@ gtk_plot_cairo_draw_string                        (GtkPlotPC *pc,
             old_tx -= descent;
             old_ty -= height;
             break;
+       default:
+           break;
       }
       break;
     case GTK_JUSTIFY_CENTER:
@@ -837,6 +841,8 @@ gtk_plot_cairo_draw_string                        (GtkPlotPC *pc,
             old_tx -= descent;
             old_ty -= height / 2.;
             break;
+       default:
+           break;
       }
   }
 
@@ -1096,12 +1102,13 @@ static void gtk_plot_cairo_draw_pixmap                (GtkPlotPC *pc,
                                                       gdouble scale_x, 
                                                       gdouble scale_y)
 {
-  if (!GTK_PLOT_CAIRO(pc)->cairo)
-    return;
-
   cairo_surface_t *image_surface = NULL;
   cairo_surface_t *mask_surface = NULL;
   cairo_t *cr;
+
+  if (!GTK_PLOT_CAIRO(pc)->cairo)
+    return;
+
 /* TODO: USE MASK */
 
   image_surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, (width-xsrc)*scale_x, 
(height-ysrc)*scale_y);
diff --git a/gtkextra/gtkplotcandle.c b/gtkextra/gtkplotcandle.c
index 6e5a0a68..ac2c3c54 100644
--- a/gtkextra/gtkplotcandle.c
+++ b/gtkextra/gtkplotcandle.c
@@ -168,7 +168,7 @@ gtk_plot_candle_draw_symbol(GtkPlotData *dataset,
        x1 = px - width;
        y1 = MIN(py, pz);
        filled = z < y;
-       height = abs(py - pz);
+       height = fabs(py - pz);
 
        gtk_plot_get_pixel(plot, x, dy, &ex, &ey);
        gtk_plot_get_pixel(plot, x, dz, &ex, &ez);
diff --git a/gtkextra/gtkplotcanvas.c b/gtkextra/gtkplotcanvas.c
index 80f1596f..adf7de51 100644
--- a/gtkextra/gtkplotcanvas.c
+++ b/gtkextra/gtkplotcanvas.c
@@ -130,8 +130,6 @@ static gboolean gtk_plot_canvas_draw            (GtkWidget *widget,
                                                  cairo_t *cr);
 static void gtk_plot_canvas_create_pixmap       (GtkWidget *widget, 
                                                  gint width, gint height);
-static void gtk_plot_canvas_child_draw         (GtkPlotCanvas *canvas,
-                                                GtkPlotCanvasChild *child);
 static void gtk_plot_canvas_child_draw_selection(cairo_t *cr,
                                                 GtkPlotCanvas *canvas,
                                                 GtkPlotCanvasChild *child,
@@ -432,6 +430,8 @@ gtk_plot_canvas_child_get_property (GObject      *object,
     case ARG_CHILD_SELECTION_MODE:
       g_value_set_int(value, child->mode);
       break;
+    default:
+      break;
   }
 }
 
@@ -477,6 +477,8 @@ gtk_plot_canvas_child_set_property (GObject      *object,
     case ARG_CHILD_SELECTION_MODE:
       child->mode = g_value_get_int(value); 
       break;
+    default:
+      break;
   }
 }
 
@@ -817,6 +819,8 @@ gtk_plot_canvas_get_property (GObject      *object,
     case ARG_CANVAS_TRANSPARENT:
       g_value_set_boolean(value, canvas->transparent);
       break;
+    default:
+      break;
   }
 }
 
@@ -858,6 +862,8 @@ gtk_plot_canvas_set_property (GObject      *object,
     case ARG_CANVAS_TRANSPARENT:
       canvas->transparent = g_value_get_boolean(value);
       break;
+    default:
+      break;
   }
 }
 
@@ -2508,6 +2514,7 @@ gtk_plot_canvas_set_line_attributes(GtkPlotCanvas *canvas, GtkPlotLine line)
         gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
                                 1, 0, 0);
         gtk_plot_pc_set_dash(canvas->pc, 0, dash, 2);
+       break;
    case GTK_PLOT_LINE_DOT_DASH:
         gtk_plot_pc_set_lineattr(canvas->pc, line.line_width,
                                 1, 0, 0);
diff --git a/gtkextra/gtkplotcanvasellipse.c b/gtkextra/gtkplotcanvasellipse.c
index 4dbee33a..50ee837f 100644
--- a/gtkextra/gtkplotcanvasellipse.c
+++ b/gtkextra/gtkplotcanvasellipse.c
@@ -196,6 +196,8 @@ gtk_plot_canvas_ellipse_get_property (GObject      *object,
     case ARG_BG:
       g_value_set_pointer(value, &ellipse->bg);
       break;
+    default:
+      break;
   }
 }
                                                                                 
@@ -217,6 +219,8 @@ gtk_plot_canvas_ellipse_set_property (GObject      *object,
     case ARG_BG:
       ellipse->bg = *((GdkRGBA *)g_value_get_pointer(value));
       break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotcanvasline.c b/gtkextra/gtkplotcanvasline.c
index 8bb38a1d..d216f053 100644
--- a/gtkextra/gtkplotcanvasline.c
+++ b/gtkextra/gtkplotcanvasline.c
@@ -327,6 +327,8 @@ gtk_plot_canvas_line_set_property (GObject      *object,
     case ARG_ARROW_STYLE:
       line->arrow_style = g_value_get_int(value);
       break;
+    default:
+      break;
   }
 }
 
@@ -369,6 +371,8 @@ gtk_plot_canvas_line_get_property (GObject      *object,
     case ARG_ARROW_STYLE:
       g_value_set_int(value, line->arrow_style);
       break;
+    default:
+      break;
   }
 }
 
@@ -419,6 +423,8 @@ gtk_plot_canvas_line_draw           (GtkPlotCanvas *canvas,
          break;
        case GTK_PLOT_SYMBOL_FILLED:
          gtk_plot_pc_draw_polygon (canvas->pc, TRUE, arrow, 3);
+       default:
+        break;
      }
   }
   if(line->arrow_mask & GTK_PLOT_CANVAS_ARROW_ORIGIN){
@@ -442,6 +448,8 @@ gtk_plot_canvas_line_draw           (GtkPlotCanvas *canvas,
          break;
        case GTK_PLOT_SYMBOL_FILLED:
          gtk_plot_pc_draw_polygon (canvas->pc, TRUE, arrow, 3);
+       default:
+        break;
      }
   }
 }
diff --git a/gtkextra/gtkplotcanvaspixmap.c b/gtkextra/gtkplotcanvaspixmap.c
index a53b1b2c..e2a10f62 100644
--- a/gtkextra/gtkplotcanvaspixmap.c
+++ b/gtkextra/gtkplotcanvaspixmap.c
@@ -174,6 +174,8 @@ gtk_plot_canvas_pixmap_get_property (GObject      *object,
     case ARG_MASK:
       g_value_set_pointer(value, pixmap->mask);
       break;
+    default:
+      break;
   }
 }
                                                                                 
@@ -196,6 +198,8 @@ gtk_plot_canvas_pixmap_set_property (GObject      *object,
       pixmap->mask = (cairo_pattern_t *)g_value_get_pointer(value);
       if(pixmap->mask) cairo_pattern_reference(pixmap->mask);
       break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotcanvasplot.c b/gtkextra/gtkplotcanvasplot.c
index 0cf6f4c2..70e0df1d 100644
--- a/gtkextra/gtkplotcanvasplot.c
+++ b/gtkextra/gtkplotcanvasplot.c
@@ -329,8 +329,8 @@ gtk_plot_canvas_plot_button_release (GtkPlotCanvas *canvas,
                            fx, fy,
                            &px, &py);
 
-        if(abs(new_x - px) <= DEFAULT_MARKER_SIZE &&
-           abs(new_y - py) <= DEFAULT_MARKER_SIZE){
+        if(fabs(new_x - px) <= DEFAULT_MARKER_SIZE &&
+           fabs(new_y - py) <= DEFAULT_MARKER_SIZE){
              cplot->marker->point = i;
              cplot->datapoint = i;
              gtk_plot_canvas_get_position(canvas, px, py,
@@ -674,7 +674,7 @@ gtk_plot_canvas_plot_button_press(GtkPlotCanvas *canvas,
                                 &fx, &fy, &fz, &fa, &fdx, &fdy, &fdz, &fda,
                                 &label, &error);
         gtk_plot_get_pixel(GTK_PLOT(plot), fx, fy, &xi, &yi);
-        if(abs(xi-x) <= 20 && abs(yi-y) <= 20){
+        if(fabs(xi-x) <= 20 && fabs(yi-y) <= 20){
 
           if(canvas->active_item == child && 
              GTK_PLOT_CANVAS_PLOT(child)->pos == GTK_PLOT_CANVAS_PLOT_IN_MARKER &&
@@ -725,8 +725,8 @@ gtk_plot_canvas_plot_button_press(GtkPlotCanvas *canvas,
                                   &fx, &fy, &fz, &fa, &fdx, &fdy, &fdz, &fda,
                                   &label, &error);
           gtk_plot_get_pixel(GTK_PLOT(plot), fx, fy, &xi, &yi);
-          if(abs(xi-x) <= DEFAULT_MARKER_SIZE &&
-             abs(yi-y) <= DEFAULT_MARKER_SIZE){
+          if(fabs(xi-x) <= DEFAULT_MARKER_SIZE &&
+             fabs(yi-y) <= DEFAULT_MARKER_SIZE){
 
             if(canvas->active_item == child && 
                GTK_PLOT_CANVAS_PLOT(child)->pos == GTK_PLOT_CANVAS_PLOT_IN_DATA &&
diff --git a/gtkextra/gtkplotcanvasrectangle.c b/gtkextra/gtkplotcanvasrectangle.c
index 1b1deb49..cfb404eb 100644
--- a/gtkextra/gtkplotcanvasrectangle.c
+++ b/gtkextra/gtkplotcanvasrectangle.c
@@ -113,6 +113,8 @@ gtk_plot_canvas_rectangle_get_property (GObject      *object,
     case ARG_BG:
       g_value_set_pointer(value, &rectangle->bg); 
       break;
+    default:
+      break;
   }
 }
 
@@ -140,6 +142,8 @@ gtk_plot_canvas_rectangle_set_property (GObject      *object,
     case ARG_BG:
       rectangle->bg = *((GdkRGBA *)g_value_get_pointer(value));
       break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotcanvastext.c b/gtkextra/gtkplotcanvastext.c
index a5765368..c70f79ca 100644
--- a/gtkextra/gtkplotcanvastext.c
+++ b/gtkextra/gtkplotcanvastext.c
@@ -197,6 +197,8 @@ gtk_plot_canvas_text_get_property (GObject      *object,
     case ARG_TEXT:
       g_value_set_pointer(value, &text->text);
       break;
+    default:
+      break;
   }
 }
 
@@ -220,6 +222,8 @@ gtk_plot_canvas_text_set_property (GObject      *object,
       if(aux_text->text) text->text.text = g_strdup(aux_text->text);
       if(aux_text->font) text->text.font = g_strdup(aux_text->font);
       break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotcsurface.c b/gtkextra/gtkplotcsurface.c
index ca7fd85c..22d12087 100644
--- a/gtkextra/gtkplotcsurface.c
+++ b/gtkextra/gtkplotcsurface.c
@@ -314,6 +314,8 @@ gtk_plot_csurface_set_property (GObject      *object,
       case ARG_SUBLEVELS_COLOR:
         data->sublevels_line.color = *((GdkRGBA *)g_value_get_pointer(value));
         break;
+      default:
+       break;
     }
 }
 
@@ -700,7 +702,11 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
         ntotal += 2;
         aux = aux->next;
       }
-      last = aux->next;
+
+      if (aux)
+             last = aux->next;
+      else
+             last = NULL;
 
       if(nlines == 0){ polygons = last; continue; }
 
@@ -900,24 +906,24 @@ gtk_plot_csurface_draw_lines(GtkPlotData *data)
         if(nxp > 0){
           gint j;
           for(j = 0; j < nxp; j++){
-            GtkPlotContourX aux = xp[j];
-            x = aux.type;
+            GtkPlotContourX auxx = xp[j];
+            x = auxx.type;
 
             if(x == 1){ 
-              if(p1->x >= aux.bb->x && p1->x <= aux.bb->x+aux.bb->width && p1->y >= aux.bb->y && p1->y <= 
aux.bb->y+aux.bb->height){
-                line[0] = aux.x1;
+              if(p1->x >= auxx.bb->x && p1->x <= auxx.bb->x+auxx.bb->width && p1->y >= auxx.bb->y && p1->y 
<= auxx.bb->y+auxx.bb->height){
+                line[0] = auxx.x1;
                 n = 1;
               } else {
                 if(n == 0) line[n++] = *p1;
-                line[n++] = aux.x1;
+                line[n++] = auxx.x1;
                 gtk_plot_pc_draw_lines(plot->pc, line, n); 
                 n = 0;
               }
             } else { /* x == 2 */
               if(n == 0) line[n++] = *p1;
-              line[n++] = aux.x1;
+              line[n++] = auxx.x1;
               gtk_plot_pc_draw_lines(plot->pc, line, n); 
-              line[0] = aux.x2;
+              line[0] = auxx.x2;
               n = 1;
             }
           }
@@ -1769,6 +1775,8 @@ hsv_to_rgb (gdouble  h, gdouble  s, gdouble  v,
           *g = w;
           *b = q;
           break;
+       default:
+         break;
       }
     }
 }
diff --git a/gtkextra/gtkplotdata.c b/gtkextra/gtkplotdata.c
index 687307f8..aaaefa5b 100644
--- a/gtkextra/gtkplotdata.c
+++ b/gtkextra/gtkplotdata.c
@@ -1992,6 +1992,8 @@ gtk_plot_data_set_property (GObject      *object,
         if(!data->gradient) return;
         data->gradient->ticks.break_position = g_value_get_double(value);
         break;
+      default:
+       break;
     }
 }
 
@@ -2690,7 +2692,7 @@ gtk_plot_data_real_real_draw   (GtkPlotData *dataset,
   array_labels = gtk_plot_data_get_labels(dataset, &n);
   a_scale = gtk_plot_data_get_a_scale(dataset);
   y_array = gtk_plot_data_dimension_get_array(dataset, "y");
-  y_scale = y_array->scale;
+  if (y_array) y_scale = y_array->scale;
   z_array = gtk_plot_data_dimension_get_array(dataset, "z");
   if(z_array) z_scale = z_array->scale;
 
@@ -3075,11 +3077,11 @@ draw_gradient_vertical(GtkPlotData *data, gdouble px, gdouble py)
 
   } else {
 
+    gint ncolors = 0;
 
     legend.x = (gdouble)(area.x + x) / (gdouble)area.width;
 
     ry = y;
-    gint ncolors = 0;
     for(level = nlevels-1; level >= 0; level--){
 /*     
       gdouble val;
@@ -3199,6 +3201,8 @@ draw_gradient_vertical(GtkPlotData *data, gdouble px, gdouble py)
         legend.justification = GTK_JUSTIFY_CENTER;
         gtk_plot_draw_text(plot, legend);
         break;
+      default:
+       break;
     }
   }
 }
@@ -3541,6 +3545,8 @@ draw_gradient_horizontal(GtkPlotData *data, gdouble px, gdouble py)
         legend.justification = GTK_JUSTIFY_CENTER;
         gtk_plot_draw_text(plot, legend);
         break;
+      default:
+       break;
     }
   }
 }
@@ -3752,6 +3758,8 @@ gtk_plot_data_set_gradient_size(GtkPlotData *data, gint size)
       case GTK_PLOT_AXIS_BOTTOM:
         gradient_height += theight + roundint(data->gradient->labels_offset * m);
         break;
+      default:
+       break;
     }
   }
 
@@ -3889,6 +3897,8 @@ gtk_plot_data_get_gradient_size(GtkPlotData *data, gint *width, gint *height)
         gradient_width = MAX(gradient_width, twidth + roundint(data->gradient->labels_offset * 3 * m));
         gradient_height += theight + roundint(data->gradient->labels_offset * m);
         break;
+      default:
+       break;
     }
   }
 
@@ -6416,8 +6426,8 @@ gtk_plot_data_get_gradient_colors (GtkPlotData *data,
                                    GdkRGBA *min,
                                    GdkRGBA *max)
 {
-  min = &data->color_min;
-  max = &data->color_max;
+  *min = data->color_min;
+  *max = data->color_max;
 }
 
 /**
@@ -6435,7 +6445,7 @@ gtk_plot_data_set_gradient_nth_color (GtkPlotData *data,
 {
   if(!data->gradient_custom) return;
 
-  if(level > data->gradient->ticks.nticks) return;
+  if((int)level > data->gradient->ticks.nticks) return;
   data->gradient_colors[level] = *color;
   g_signal_emit(data, data_signals[GRADIENT_COLORS_CHANGED], 0);
 }
@@ -6453,7 +6463,7 @@ const GdkRGBA *
 gtk_plot_data_get_gradient_nth_color (GtkPlotData *data,
                                       guint level)
 {
-  if(level > data->gradient->ticks.nticks) return NULL;
+  if((int)level > data->gradient->ticks.nticks) return NULL;
   return &data->gradient_colors[level];
 }
 
@@ -6488,8 +6498,8 @@ gtk_plot_data_get_gradient_outer_colors (GtkPlotData *data,
                                          GdkRGBA *min,
                                          GdkRGBA *max)
 {
-  min = &data->color_lt_min;
-  max = &data->color_gt_max;
+  *min = data->color_lt_min;
+  *max = data->color_gt_max;
 }
 
 /**
@@ -6710,6 +6720,8 @@ hsv_to_rgb (gdouble  h, gdouble  s, gdouble  v,
           *g = w;
           *b = q;
           break;
+       default:
+         break;
       }
     }
 }
@@ -6938,7 +6950,7 @@ gtk_plot_data_add_marker(GtkPlotData *data, guint point)
   GList *list = NULL;
 */
 
-  if(point >= data->num_points) return FALSE;
+  if((int)point >= data->num_points) return FALSE;
 
 /*
   list = data->markers;
diff --git a/gtkextra/gtkplotdt.c b/gtkextra/gtkplotdt.c
index b9c56792..3a4e0e07 100644
--- a/gtkextra/gtkplotdt.c
+++ b/gtkextra/gtkplotdt.c
@@ -1049,8 +1049,12 @@ gtk_plot_dt_compare_nodes_xy_wise(gconstpointer a, gconstpointer b)
       return  1; break;
     case  0:
       return  0; break;
+    default:
+      break;
     }
     break;
+  default:
+    break;
   }
   
   /* just in case: */
diff --git a/gtkextra/gtkplotflux.c b/gtkextra/gtkplotflux.c
index 52132964..a620381d 100644
--- a/gtkextra/gtkplotflux.c
+++ b/gtkextra/gtkplotflux.c
@@ -368,6 +368,8 @@ gtk_plot_flux_set_property (GObject      *object,
       case ARG_LABEL_SUFFIX:
         gtk_plot_flux_set_labels_suffix(data, g_value_get_string(value));
         break;
+      default:
+       break;
     }
 }
 
@@ -423,7 +425,7 @@ gtk_plot_flux_get_property (GObject      *object,
 }
 
 GtkWidget*
-gtk_plot_flux_new ()
+gtk_plot_flux_new (void)
 {
   GtkWidget *widget;
 
@@ -740,6 +742,9 @@ gtk_plot_flux_draw_arrow(GtkPlotFlux *flux, gdouble x1, gdouble y1, gdouble x2,
       break;
     case GTK_PLOT_SYMBOL_FILLED:
       gtk_plot_pc_draw_polygon (plot->pc, TRUE, arrow, 3);
+      break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotpixmap.c b/gtkextra/gtkplotpixmap.c
index 64005280..c84abedc 100644
--- a/gtkextra/gtkplotpixmap.c
+++ b/gtkextra/gtkplotpixmap.c
@@ -149,6 +149,8 @@ gtk_plot_pixmap_get_property (GObject      *object,
     case ARG_MASK:
       g_value_set_pointer(value, pixmap->mask);
       break;
+    default:
+      break;
   }
 }
                                                                                 
@@ -171,6 +173,8 @@ gtk_plot_pixmap_set_property (GObject      *object,
       pixmap->mask = (cairo_pattern_t *)g_value_get_pointer(value);
       if(pixmap->mask) cairo_pattern_reference(pixmap->mask);
       break;
+    default:
+      break;
   }
 }
 
diff --git a/gtkextra/gtkplotpolar.c b/gtkextra/gtkplotpolar.c
index 0d2aadc6..9b114e72 100644
--- a/gtkextra/gtkplotpolar.c
+++ b/gtkextra/gtkplotpolar.c
@@ -208,6 +208,8 @@ gtk_plot_polar_set_property (GObject      *object,
     case ARG_ROTATION:
       plot->rotation = g_value_get_double(value);
       break;
+    default:
+      break;
   }
 }
 
@@ -671,6 +673,8 @@ gtk_plot_polar_draw_labels(GtkPlotPolar *polar,
            break;
     case 270:
            break;
+    default:
+          break;
   }
 
   if(axis->direction.x == 0)
diff --git a/gtkextra/gtkplotps.c b/gtkextra/gtkplotps.c
index 626f402c..ebe66fcd 100644
--- a/gtkextra/gtkplotps.c
+++ b/gtkextra/gtkplotps.c
@@ -125,7 +125,7 @@ static void psdrawpixmap                        (GtkPlotPC *pc,
                                                  gint width, gint height,
                                                  gdouble sx, gdouble sy);
 
-static void ps_reencode_font                   (FILE *file, char *fontname);
+static void ps_reencode_font                   (FILE *file, const char *fontname);
 static void color_to_hex                        (GdkColor color,
                                                  gchar string[7]);
 
@@ -681,7 +681,7 @@ psinit                                              (GtkPlotPC *pc)
     return TRUE;
 }
 
-static void ps_reencode_font(FILE *file, char *fontname)
+static void ps_reencode_font(FILE *file, const char *fontname)
 {
   /* Don't reencode the Symbol font, as it doesn't work in latin1 encoding.
    * Instead, just define Symbol-latin1 to be the same as Symbol. */
diff --git a/gtkextra/gtkplotsurface.c b/gtkextra/gtkplotsurface.c
index b44b9019..b05b50f3 100644
--- a/gtkextra/gtkplotsurface.c
+++ b/gtkextra/gtkplotsurface.c
@@ -404,6 +404,8 @@ gtk_plot_surface_set_property (GObject      *object,
       case ARG_MESH_COLOR:
         data->mesh_line.color = *((GdkRGBA *)g_value_get_pointer(value));
         break;
+      default:
+       break;
     }
 }
 
@@ -1024,7 +1026,7 @@ gtk_plot_surface_draw_legend(GtkPlotData *data, gint x, gint y)
                / (gdouble)area.width;
     legend.y = (gdouble)(area.y + y + lascent) / (gdouble)area.height;
   
-    if(data->legend && data->legend != '\0') gtk_plot_draw_text(plot, legend);
+    if(data->legend && data->legend[0] != '\0') gtk_plot_draw_text(plot, legend);
   
     y += 2*lheight;
   } else 
@@ -1123,6 +1125,8 @@ hsv_to_rgb (gdouble  h, gdouble  s, gdouble  v,
           *g = w;
           *b = q;
           break;
+       default:
+         break;
       }
     }
 }
diff --git a/gtkextra/gtkpsfont.c b/gtkextra/gtkpsfont.c
index 51fff9c5..772e7d5a 100644
--- a/gtkextra/gtkpsfont.c
+++ b/gtkextra/gtkpsfont.c
@@ -332,7 +332,7 @@ gtk_psfont_init(void)
   psfont_families = NULL;
   numf = 0;
 
-  for(i = 0; i < NUM_FONTS; i++){
+  for(i = 0; i < (int)NUM_FONTS; i++){
     new_family = TRUE;
     for(j = 0; j < numf; j++){
        if(strcmp(font_data[i].family, (gchar *)g_list_nth_data(psfont_families, j)) == 0)
@@ -666,7 +666,7 @@ find_psfont(const gchar *name)
   }
 
   if(fontdata == NULL) {
-    for(i = 0; i < NUM_FONTS; i++){
+    for(i = 0; i < (int)NUM_FONTS; i++){
       if(strcmp(name, font_data[i].fontname) == 0) {
        fontdata = &font_data[i];
        break;
@@ -719,7 +719,7 @@ gtk_psfont_get_by_family(const gchar *family_name, gboolean italic, gboolean bol
   }
 
   if(fontdata == NULL) {
-    for(i = 0; i < NUM_FONTS; i++){
+    for(i = 0; i < (int)NUM_FONTS; i++){
       if(strcmp(family_name, font_data[i].family) == 0) {
        return_data = &font_data[i];
        if(font_data[i].italic == italic && font_data[i].bold == bold){
diff --git a/src/calc.c b/src/calc.c
index 400aa8dd..31b23b07 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -62,7 +62,7 @@ extern int gel_first_tok;
 extern gboolean gel_lex_init;
 
 extern char *yytext;
-extern int yydebug;
+/* extern int yydebug; */
 
 extern const char *genius_toplevels[];
 
@@ -1157,10 +1157,10 @@ appendmatrix_mathml (GelOutput *gelo, GelMatrixW *m, gboolean nice)
                        gel_output_string (gelo, "\n");
        }
        
-       if (nice)
-               gel_output_string (gelo, "</matrix>");
-       else
+       /*if (nice)
                gel_output_string (gelo, "</matrix>");
+       else*/
+       gel_output_string (gelo, "</matrix>");
 }
 
 static void
@@ -3152,8 +3152,8 @@ do_exec_commands (const char *dirprefix)
                        if G_UNLIKELY (gel_interrupted)
                                break;
                }
-               g_slist_foreach (list, (GFunc)g_free, NULL);
-               g_slist_free (list);
+               g_slist_free_full (list, g_free);
+               list = NULL;
                ret = TRUE;
                break;
        case GEL_CHANGEDIR:
@@ -3163,8 +3163,8 @@ do_exec_commands (const char *dirprefix)
                for (li = list; li != NULL; li = li->next) {
                        our_chdir (dirprefix, li->data);
                }
-               g_slist_foreach (list, (GFunc)g_free, NULL);
-               g_slist_free (list);
+               g_slist_free_full (list, g_free);
+               list = NULL;
                ret = TRUE;
                break;
        case GEL_LOADPLUGIN:
@@ -3261,8 +3261,8 @@ do_exec_commands (const char *dirprefix)
                        }
                }
 
-               g_slist_foreach (list, (GFunc)g_free, NULL);
-               g_slist_free (list);
+               g_slist_free_full (list, g_free);
+               list = NULL;
                ret = TRUE;
                break;
        case GEL_PWD:
@@ -3511,14 +3511,15 @@ gel_evalexp_parsed (GelETree *parsed,
        } else if(ret->type == GEL_OPERATOR_NODE &&
                ret->op.oper == GEL_E_REFERENCE) {
                GelETree *t = ret->op.args;
-               if(!t) {
+               if (t != NULL) {
                        GelEFunc *rf = d_lookup_global(t->id.id);
                        if(rf)
                                d_addfunc(d_makereffunc(d_intern("Ans"),rf));
                        else
                                d_addfunc(d_makevfunc(d_intern("Ans"),gel_makenum_ui(0)));
-               } else
+               } else {
                                d_addfunc(d_makevfunc(d_intern("Ans"),gel_makenum_ui(0)));
+               }
                gel_freetree(ret);
        } else
                d_addfunc(d_makevfunc(d_intern("Ans"),ret));
@@ -3539,10 +3540,10 @@ gel_evalexp (const char *str,
 }
 
 /*just to make the compiler happy*/
-void yyerror(char *s);
+void yyerror(const char *s);
 
 void
-yyerror (char *s)
+yyerror (const char *s)
 {
        char *p;
        
diff --git a/src/calc.h b/src/calc.h
index 983401eb..dcc8df43 100644
--- a/src/calc.h
+++ b/src/calc.h
@@ -73,7 +73,7 @@ typedef struct {
 } GelCalcState;
 
 /*so we can use and set the yyparse function for parse errors*/
-int yyparse(void);
+/* int yyparse(void); */
 
 /*make a string representation of an expression*/
 void   gel_print_etree         (GelOutput *gelo,
diff --git a/src/eval.c b/src/eval.c
index 2e8c81b1..498696ce 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -58,7 +58,7 @@ static void _gel_make_free_evfi (void);
 static GelCtx *most_recent_ctx = NULL;
 #endif
 
-static inline void
+static void
 ge_add_stack_array(GelCtx *ctx)
 {
        GelEvalStack *newstack;
@@ -88,7 +88,7 @@ ge_add_stack_array(GelCtx *ctx)
        *((thectx)->topstack ++) = GINT_TO_POINTER(flag);               \
 }
 
-static inline gboolean
+static gboolean
 ge_remove_stack_array(GelCtx *ctx)
 {
        GelEvalStack *next = ctx->stack->next;
@@ -190,7 +190,7 @@ ge_remove_stack_array(GelCtx *ctx)
 
 static void mod_node(GelETree *n, mpw_ptr mod);
 static void mod_matrix (GelMatrixW *m, mpw_ptr mod);
-static inline GelEFunc * get_func_from (GelETree *l, gboolean silent);
+static GelEFunc * get_func_from (GelETree *l, gboolean silent);
 static int branches (int op) G_GNUC_CONST;
 
 
@@ -531,7 +531,7 @@ gel_makenum_use_from (GelETree *n, mpw_t num)
        memcpy (n->val.value, num, sizeof (struct _mpw_t));
 }
 
-static inline void
+static void
 freetree_full (GelETree *n, gboolean freeargs, gboolean kill)
 {
        if (!n)
@@ -599,7 +599,8 @@ freetree_full (GelETree *n, gboolean freeargs, gboolean kill)
                        gel_freetree(n->loc.arg);
                g_slist_free (n->loc.idents);
                break;
-       default: break;
+       default:
+               break;
        }
        if(kill) {
                /*
@@ -688,7 +689,7 @@ freenode(GelETree *n)
        freetree_full(n,FALSE,TRUE);
 }
 
-static inline void
+static void
 copynode_to(GelETree *empty, GelETree *o)
 {
        switch(o->type) {
@@ -810,7 +811,7 @@ gel_copynode(GelETree *o)
        return n;
 }
 
-static inline void
+static void
 replacenode(GelETree *to, GelETree *from)
 {
        GelETree *next = to->any.next;
@@ -837,7 +838,7 @@ replacenode(GelETree *to, GelETree *from)
 
        /*printf ("replaced from: %p\n", from);*/
 }
-static inline void
+static void
 copyreplacenode(GelETree *to, GelETree *from)
 {
        GelETree *next = to->any.next;
@@ -1287,11 +1288,11 @@ gel_expandmatrix (GelETree *n)
        h = gel_matrixw_height (nm);
 
        if (w == 1 && h == 1) {
-               GelETree *t = gel_matrixw_get_index (nm, 0, 0);
+               GelETree *t = gel_matrixw_get_indexii (nm, 0);
                if (t != NULL &&
                    t->type == GEL_MATRIX_NODE) {
                        if (nm->m->use == 1) {
-                               gel_matrixw_set_index (nm, 0, 0) = NULL;
+                               gel_matrixw_set_indexii (nm, 0) = NULL;
                        } else {
                                t = gel_copynode (t);
                        }
@@ -1945,9 +1946,9 @@ matrix_addsub_scalar_matrix_op (GelCtx *ctx, GelETree *n, GelETree *l, GelETree
        gel_matrixw_make_private(m, TRUE /* kill_type_caches */);
 
        for (i = 0; i < gel_matrixw_width (m); i++) {
-               GelETree *t = gel_matrixw_get_index(m,i,i);
+               GelETree *t = gel_matrixw_get_indexii(m,i);
                /* Only for ADD/SUB so order is unimportant */
-               gel_matrixw_set_index (m, i, i) =
+               gel_matrixw_set_indexii (m, i) =
                        op_two_nodes (ctx,
                                      t ? t : the_zero,
                                      node, n->op.oper,
@@ -2178,7 +2179,7 @@ matrix_pow_op(GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
                                     gel_matrixw_height(m));
                /* width == height */
                for(i=0;i<gel_matrixw_width(m);i++)
-                       gel_matrixw_set_index(mi,i,i) =
+                       gel_matrixw_set_indexii(mi,i) =
                                gel_makenum_ui(1);
                if(power==0) {
                        freetree_full(n,TRUE,FALSE);
@@ -2295,7 +2296,7 @@ pure_matrix_div_op(GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
                         gel_matrixw_height(m1));
        /* width == height */
        for(i=0;i<gel_matrixw_width(m1);i++)
-               gel_matrixw_set_index(mi,i,i) =
+               gel_matrixw_set_indexii(mi,i) =
                        gel_makenum_ui(1);
 
        if(n->op.oper == GEL_E_BACK_DIV)
@@ -2366,7 +2367,7 @@ value_matrix_div_op(GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
                         gel_matrixw_height(m));
        /* width == height */
        for(i=0;i<gel_matrixw_width(m);i++)
-               gel_matrixw_set_index(mi,i,i) =
+               gel_matrixw_set_indexii(mi,i) =
                        gel_makenum_ui(1);
 
        m = gel_matrixw_copy(m);
@@ -2408,6 +2409,7 @@ value_matrix_div_op(GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
 static gboolean
 polynomial_add_sub_op (GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
 {
+#if 0
        if (l->type == GEL_VALUE_NODE) {
                /* r->type == GEL_POLYNOMIAL_NODE */
                /* FIXME implement */
@@ -2417,6 +2419,7 @@ polynomial_add_sub_op (GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
        } else {
                /* FIXME implement */
        }
+#endif
 
        return TRUE;
 }
@@ -3291,7 +3294,7 @@ purge_free_lists(void)
 #endif
 }
 
-static inline GelEvalLoop *
+static GelEvalLoop *
 evl_new (GelETree *cond, GelETree *body, gboolean is_while, gboolean body_first)
 {
        GelEvalLoop *evl;
@@ -3310,7 +3313,7 @@ evl_new (GelETree *cond, GelETree *body, gboolean is_while, gboolean body_first)
        return evl;
 }
 
-static inline void
+static void
 evl_free(GelEvalLoop *evl)
 {
 #ifdef MEM_DEBUG_FRIENDLY
@@ -3331,7 +3334,7 @@ evl_free_with_cond(GelEvalLoop *evl)
        evl_free (evl);
 }
 
-static inline GelEvalFor *
+static GelEvalFor *
 evf_new (GelEvalForType type,
         mpw_ptr x,
         mpw_ptr to,
@@ -3362,7 +3365,7 @@ evf_new (GelEvalForType type,
        return evf;
 }
 
-static inline void
+static void
 evf_free(GelEvalFor *evf)
 {
 #ifdef MEM_DEBUG_FRIENDLY
@@ -3376,7 +3379,7 @@ evf_free(GelEvalFor *evf)
 #endif
 }
 
-static inline GelEvalForIn *
+static GelEvalForIn *
 evfi_new (GelEvalForType type, GelMatrixW *mat, GelETree *body, GelETree *orig_body, GelToken *id)
 {
        GelEvalForIn *evfi;
@@ -3398,7 +3401,7 @@ evfi_new (GelEvalForType type, GelMatrixW *mat, GelETree *body, GelETree *orig_b
        return evfi;
 }
 
-static inline void
+static void
 evfi_free(GelEvalForIn *evfi)
 {
 #ifdef MEM_DEBUG_FRIENDLY
@@ -3520,7 +3523,7 @@ gel_similar_possible_ids (const char *id)
        return g_string_free (sim, FALSE);
 }
 
-static inline gboolean
+static gboolean
 iter_variableop(GelCtx *ctx, GelETree *n)
 {
        GelEFunc *f;
@@ -3567,7 +3570,7 @@ iter_variableop(GelCtx *ctx, GelETree *n)
        }
 }
 
-static inline gboolean
+static gboolean
 iter_derefvarop(GelCtx *ctx, GelETree *n)
 {
        GelEFunc *f;
@@ -3783,7 +3786,7 @@ evalcomp(GelETree *n)
 
 #undef RET_RES
 
-static inline void
+static void
 pop_stack_with_whack (GelCtx *ctx)
 {
        gpointer data;
@@ -3798,7 +3801,7 @@ pop_stack_with_whack (GelCtx *ctx)
 
 
 /* free a special stack entry */
-static inline void
+static void
 ev_free_special_data(GelCtx *ctx, gpointer data, int flag)
 {
        switch(flag) {
@@ -4382,7 +4385,7 @@ iter_pop_stack(GelCtx *ctx)
   and adds the GE_WHACKARG so that we free unused thingies
   earlier from separators, expects at least two arguments!!!!,
   else first argument will be whacked */
-static inline GelETree *
+static GelETree *
 iter_push_args_whack(GelCtx *ctx, GelETree *args, int n)
 {
        GelETree *t = args;
@@ -4432,7 +4435,14 @@ iter_push_args_whack(GelCtx *ctx, GelETree *args, int n)
                                li = li->any.next;
                        }
 
+#if defined __GNUC__ && 7 <= __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wnull-dereference"
+#endif
                        t = list->data;
+#if defined __GNUC__ && 7 <= __GNUC__
+# pragma GCC diagnostic pop
+#endif
                        GE_PUSH_STACK (ctx, t, GE_PRE);
 #ifdef MEM_DEBUG_FRIENDLY
                        list->data = NULL;
@@ -4454,7 +4464,7 @@ iter_push_args_whack(GelCtx *ctx, GelETree *args, int n)
 }
 
 /* push n of the arguments on the stack */
-static inline void
+static void
 pushstack_n_args (GelCtx *ctx, GelETree *args, int n)
 {
        switch (n) {
@@ -4504,7 +4514,7 @@ pushstack_n_args (GelCtx *ctx, GelETree *args, int n)
 
 /*make first argument the "current",
   go into "pre" mode and push all other ones*/
-static inline void
+static void
 iter_push_args(GelCtx *ctx, GelETree *args, int n)
 {
        ctx->post = FALSE;
@@ -4516,7 +4526,7 @@ iter_push_args(GelCtx *ctx, GelETree *args, int n)
 
 /*make first argument the "current",
  *and push all other args.  evaluate with no modulo. */
-static inline void
+static void
 iter_push_args_no_modulo (GelCtx *ctx, GelETree *args, int n)
 {
        ctx->post = FALSE;
@@ -4535,7 +4545,7 @@ iter_push_args_no_modulo (GelCtx *ctx, GelETree *args, int n)
 
 /*make first argument the "current",
   push no modulo on the second argument */
-static inline void
+static void
 iter_push_two_args_no_modulo_on_2 (GelCtx *ctx, GelETree *args)
 {
        ctx->post = FALSE;
@@ -4557,7 +4567,7 @@ iter_push_two_args_no_modulo_on_2 (GelCtx *ctx, GelETree *args)
 
 /*when a matrix contains other things than NULLs, VALUEs, and STRINGs,
   make a copy of it and evaluate it's nodes*/
-static inline void
+static void
 iter_push_matrix(GelCtx *ctx, GelETree *n, GelMatrixW *m)
 {
        int x,y;
@@ -4919,7 +4929,7 @@ funccall_done_ok:
        return TRUE;
 }
 
-static inline void
+static void
 iter_returnop(GelCtx *ctx, GelETree *n)
 {
        GelETree *r;
@@ -4972,7 +4982,7 @@ iter_returnop(GelCtx *ctx, GelETree *n)
        replacenode(ctx->res,r);
 }
 
-static inline void
+static void
 iter_forloop (GelCtx *ctx, GelETree *n, gboolean *repushed)
 {
        GelEvalFor *evf;
@@ -5095,7 +5105,7 @@ iter_forloop (GelCtx *ctx, GelETree *n, gboolean *repushed)
        ctx->whackarg = FALSE;
 }
 
-static inline void
+static void
 iter_forinloop(GelCtx *ctx, GelETree *n, gboolean *repushed)
 {
        GelEvalForIn *evfi;
@@ -5174,7 +5184,7 @@ iter_forinloop(GelCtx *ctx, GelETree *n, gboolean *repushed)
        ctx->whackarg = FALSE;
 }
 
-static inline void
+static void
 iter_loop (GelCtx *ctx, GelETree *n, gboolean body_first, gboolean is_while)
 {
        GelEvalLoop *evl;
@@ -5203,7 +5213,7 @@ iter_loop (GelCtx *ctx, GelETree *n, gboolean body_first, gboolean is_while)
        }
 }
 
-static inline void
+static void
 iter_ifop(GelCtx *ctx, GelETree *n, gboolean has_else, gboolean *repushed)
 {
        GelETree *l,*r,*rr = NULL;
@@ -5262,7 +5272,7 @@ iter_ifop(GelCtx *ctx, GelETree *n, gboolean has_else, gboolean *repushed)
   but the code differs slightly so we just make a macro that subsitutes
   the right types, values and free functions*/
 #define LOOP_BREAK_CONT(structtype,freefunc,pushflag) { \
-       structtype *e = data;                                   \
+       structtype *e = data;                           \
        if(cont) {                                      \
                freetree_full(e->body,TRUE,FALSE);      \
                e->body->type = GEL_NULL_NODE;          \
@@ -5283,12 +5293,15 @@ iter_ifop(GelCtx *ctx, GelETree *n, gboolean has_else, gboolean *repushed)
                /*pop loop call tree*/                  \
                GE_POP_STACK(ctx,n,flag);               \
                                                        \
-               if (flag & GE_WHACKARG) {               \
-                       gel_freetree (n);               \
-               } else {                                \
-                       /*null the tree*/               \
-                       freetree_full(n,TRUE,FALSE);    \
-                       n->type = GEL_NULL_NODE;        \
+               /* just for sanity */                   \
+               if G_LIKELY (n != NULL) {               \
+                       if (flag & GE_WHACKARG) {       \
+                               gel_freetree (n);       \
+                       } else {                        \
+                               /*null the tree*/       \
+                               freetree_full(n,TRUE,FALSE); \
+                               n->type = GEL_NULL_NODE; \
+                       }                               \
                }                                       \
                                                        \
                /*go on with the computation*/          \
@@ -5297,7 +5310,7 @@ iter_ifop(GelCtx *ctx, GelETree *n, gboolean has_else, gboolean *repushed)
        return;                                         \
 }
 
-static inline void
+static void
 iter_continue_break_op(GelCtx *ctx, gboolean cont)
 {
        EDEBUG("  CONTINUE/BREAK");
@@ -5357,7 +5370,7 @@ iter_continue_break_done:
 
 #undef LOOP_BREAK_CONT
 
-static inline void
+static void
 iter_bailout_op(GelCtx *ctx)
 {
        EDEBUG("  BAILOUT");
@@ -5450,7 +5463,7 @@ iter_get_matrix_index_vector (GelETree *index, int maxsize, int *vlen)
 }
 
 /* assumes index->type == GEL_VALUE_NODE */
-static inline int
+static int
 iter_get_matrix_index_num (GelETree *index, int maxsize)
 {
        int i = iter_get_ui_index (index) - 1;
@@ -6089,7 +6102,7 @@ iter_incrementop (GelETree *n)
 
                if (index->type == GEL_VALUE_NODE ||
                    index->type == GEL_MATRIX_NODE) {
-                       int *regx, *regy;
+                       int *regx = NULL, *regy = NULL;
                        int lx, ly;
                        int i;
 
@@ -6391,7 +6404,7 @@ iter_parameterop (GelETree *n)
        replacenode (n, rr);
 }
 
-static inline void
+static void
 iter_push_indexes_and_arg(GelCtx *ctx, GelETree *n)
 {
        GelETree *l;
@@ -6426,7 +6439,7 @@ iter_push_indexes_and_arg(GelCtx *ctx, GelETree *n)
        }
 }
 
-static inline void
+static void
 iter_do_push_index (GelCtx *ctx, GelETree *l)
 {
        if (l->op.oper == GEL_E_GET_ELEMENT) {
@@ -6446,7 +6459,7 @@ iter_do_push_index (GelCtx *ctx, GelETree *l)
        }
 }
 
-static inline void
+static void
 iter_push_left_indexes_only(GelCtx *ctx, GelETree *n)
 {
        GelETree *l;
@@ -6457,7 +6470,7 @@ iter_push_left_indexes_only(GelCtx *ctx, GelETree *n)
        iter_pop_stack (ctx);
 }
 
-static inline void
+static void
 iter_push_indexes_both (GelCtx *ctx, GelETree *n)
 {
        GelETree *l,*r;
@@ -6661,7 +6674,8 @@ iter_get_region (GelETree *n, gboolean col)
        }
 }
 
-static inline guint32
+static guint32 iter_get_arg(GelETree *n) G_GNUC_PURE;
+static guint32
 iter_get_arg(GelETree *n)
 {
        switch(n->type) {
@@ -6737,7 +6751,7 @@ iter_get_op_name(int oper)
        return name;
 }
 
-static inline gboolean
+static gboolean
 iter_call2(GelCtx *ctx, const GelOper *op, GelETree *n)
 {
        GelETree *l,*r;
@@ -6768,7 +6782,7 @@ iter_call2(GelCtx *ctx, const GelOper *op, GelETree *n)
        return TRUE;
 }
 
-static inline gboolean
+static gboolean
 iter_call1(GelCtx *ctx, const GelOper *op, GelETree *n)
 {
        GelETree *l;
diff --git a/src/funclib.c b/src/funclib.c
index d2de16e8..1c6edde6 100644
--- a/src/funclib.c
+++ b/src/funclib.c
@@ -3398,7 +3398,7 @@ I_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
                gel_matrixw_set_size (m, size, size);
 
                for (i = 0; i < size; i++)
-                       gel_matrixw_set_index (m, i, i) =
+                       gel_matrixw_set_indexii (m, i) =
                                gel_makenum_ui(1);
                /* This is in row reduced form, duh! */
                m->rref = 1;
@@ -4760,8 +4760,8 @@ Factorize_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
                mpw_t num;
                mpw_init (num);
                mpw_set_mpz_use (num, f.num);
-               gel_matrixw_set_index (mn, i, 0) = gel_makenum_use (num);
-               gel_matrixw_set_index (mn, i, 1) = gel_makenum_ui (f.exp);
+               gel_matrixw_set_index (mn, (int)i, 0) = gel_makenum_use (num);
+               gel_matrixw_set_index (mn, (int)i, 1) = gel_makenum_ui (f.exp);
        }
 
        g_array_free (fact, TRUE /*free segment */);
@@ -6627,8 +6627,7 @@ AskButtons_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
        i = 1;
        while (a != NULL && a[i] != NULL) {
                if G_UNLIKELY ( ! check_argument_string (a, i, "AskButtons")) {
-                       g_slist_foreach (buttons, (GFunc)g_free, NULL);
-                       g_slist_free (buttons);
+                       g_slist_free_full (buttons, g_free);
                        return NULL;
                }
                buttons = g_slist_append (buttons, g_strdup (a[i]->str.str));
@@ -6637,8 +6636,7 @@ AskButtons_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
 
        ret = gel_ask_buttons (a[0]->str.str, buttons);
 
-       g_slist_foreach (buttons, (GFunc)g_free, NULL);
-       g_slist_free (buttons);
+       g_slist_free_full (buttons, g_free);
        
        if (ret < 0)
                return gel_makenum_null ();
diff --git a/src/graphing.c b/src/graphing.c
index 6d578e0c..592ead9d 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -3506,7 +3506,7 @@ make_matrix_from_limits (void)
        n->mat.quoted = FALSE;
        gel_matrixw_set_size (m, 4, 1);
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_d (defx1);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_d (defx1);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_d (defx2);
        gel_matrixw_set_index (m, 2, 0) = gel_makenum_d (defy1);
        gel_matrixw_set_index (m, 3, 0) = gel_makenum_d (defy2);
@@ -3528,7 +3528,7 @@ make_matrix_from_lp_varnames (void)
 
        init_var_names ();
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_string (lp_x_name);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_string (lp_x_name);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_string (lp_y_name);
        gel_matrixw_set_index (m, 2, 0) = gel_makenum_string (lp_z_name);
        gel_matrixw_set_index (m, 3, 0) = gel_makenum_string (lp_t_name);
@@ -3550,7 +3550,7 @@ make_matrix_from_sp_varnames (void)
 
        init_var_names ();
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_string (sp_x_name);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_string (sp_x_name);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_string (sp_y_name);
        gel_matrixw_set_index (m, 2, 0) = gel_makenum_string (sp_z_name);
 
@@ -3676,7 +3676,7 @@ make_matrix_from_limits_surf (void)
        n->mat.quoted = FALSE;
        gel_matrixw_set_size (m, 6, 1);
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_d (surf_defx1);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_d (surf_defx1);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_d (surf_defx2);
        gel_matrixw_set_index (m, 2, 0) = gel_makenum_d (surf_defy1);
        gel_matrixw_set_index (m, 3, 0) = gel_makenum_d (surf_defy2);
@@ -3752,7 +3752,7 @@ make_matrix_from_ticks (int v, int h)
        n->mat.quoted = FALSE;
        gel_matrixw_set_size (m, 2, 1);
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_si (v);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_si (v);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_si (h);
 
        return n;
@@ -8386,7 +8386,7 @@ LinePlotWaitForClick_op (GelCtx *ctx, GelETree * * a, int *exception)
        n->mat.quoted = FALSE;
        gel_matrixw_set_size (m, 2, 1);
 
-       gel_matrixw_set_index (m, 0, 0) = gel_makenum_d (click_x);
+       gel_matrixw_set_indexii (m, 0) = gel_makenum_d (click_x);
        gel_matrixw_set_index (m, 1, 0) = gel_makenum_d (click_y);
 
        return n;
@@ -8416,7 +8416,7 @@ LinePlotMouseLocation_op (GelCtx *ctx, GelETree * * a, int *exception)
                n->mat.quoted = FALSE;
                gel_matrixw_set_size (m, 2, 1);
 
-               gel_matrixw_set_index (m, 0, 0) = gel_makenum_d (x);
+               gel_matrixw_set_indexii (m, 0) = gel_makenum_d (x);
                gel_matrixw_set_index (m, 1, 0) = gel_makenum_d (y);
 
                return n;
diff --git a/src/lexer.l b/src/lexer.l
index 10ac95d3..477e7900 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -46,9 +46,9 @@ static GSList *matrix_entry_stack = NULL;
 /* Ugly warning avoiding */
 #define yywrap() 1
 #define YY_SKIP_YYWRAP
-#ifdef FLEX_SCANNER
+/*#ifdef FLEX_SCANNER
 int yylex(void);
-#endif
+#endif*/
 
 #define NO_RET {gel_return_ret = FALSE;}
 #define DO_RET { \
diff --git a/src/matop.c b/src/matop.c
index cb12ad09..4211b17a 100644
--- a/src/matop.c
+++ b/src/matop.c
@@ -415,7 +415,7 @@ gel_value_matrix_gauss (GelCtx *ctx,
                if (w > h) {
                        ret = FALSE;
                } else {
-                       GelETree *t = gel_matrixw_get_index(m,w-1,w-1);
+                       GelETree *t = gel_matrixw_get_indexii(m,w-1);
                        if (t == NULL ||
                            mpw_zero_p (t->val.value))
                                ret = FALSE;
@@ -695,7 +695,7 @@ gel_value_matrix_det (GelCtx *ctx, mpw_t rop, GelMatrixW *m)
        if (m->rref) {
                mpw_set_ui (rop, 1);
                for (i = 0; i < w; i++) {
-                       GelETree *t = gel_matrixw_get_index (m, i, i);
+                       GelETree *t = gel_matrixw_get_indexii (m, i);
                        if (t == NULL ||
                            mpw_zero_p (t->val.value)) {
                                mpw_set_ui (rop, 0);
@@ -731,7 +731,7 @@ gel_value_matrix_det (GelCtx *ctx, mpw_t rop, GelMatrixW *m)
                mpw_mul(rop,tmp,gel_matrixw_index(mm,0,0)->val.value);
                mpw_clear(tmp);
                for (i = 1; i < w; i++) {
-                       GelETree *t = gel_matrixw_get_index(mm,i,i);
+                       GelETree *t = gel_matrixw_get_indexii(mm,i);
                        if (t == NULL) {
                                gel_matrixw_free(mm);
                                mpw_set_ui(rop,0);
diff --git a/src/matrixw.c b/src/matrixw.c
index 3440856c..14ac8466 100644
--- a/src/matrixw.c
+++ b/src/matrixw.c
@@ -28,11 +28,6 @@
 #include "calc.h"
 #include "matrix.h"
 
-/*implement the inline functions*/
-#undef G_INLINE_FUNC
-#undef G_CAN_INLINE
-#define        G_INLINE_FUNC extern
-#define        G_CAN_INLINE 1
 #include "matrixw.h"
 
 /* #define MATRIX_DEBUG 1 */
@@ -101,7 +96,7 @@ getmax (const int *reg, int len)
 }
 
 /* This should be streamlined */
-static inline gboolean
+static gboolean
 has_duplicates (const int *reg, int l)
 {
        int i, ii;
@@ -1081,7 +1076,7 @@ gel_matrixw_diagonalof (GelMatrixW *source)
        gel_matrix_set_size (mm, 1, len, FALSE /* padding */);
 
        for (i = 0; i < len; i++) {
-               GelETree *n = gel_matrixw_get_index (source, i, i);
+               GelETree *n = gel_matrixw_get_indexii (source, i);
                if (n != NULL)
                        n = gel_copynode (n);
 
@@ -1371,15 +1366,12 @@ gel_matrixw_set_vregion_etree (GelMatrixW *m, GelETree *src, int *desti, int len
        }
 }
 
-#ifndef G_CAN_INLINE
 GelETree *
 gel_matrixw_index(GelMatrixW *m, int x, int y) {
        GelETree *t = gel_matrixw_get_index (m, x, y);
        return t?t:the_zero;
 }
-#endif
 
-#ifndef G_CAN_INLINE
 GelETree *
 gel_matrixw_vindex(GelMatrixW *m, int i) {
        GelETree *t;
@@ -1393,10 +1385,8 @@ gel_matrixw_vindex(GelMatrixW *m, int i) {
                t = gel_matrixw_index (m, i % w, i / w);
        return t ? t : the_zero;
 }
-#endif
 
-#ifndef G_CAN_INLINE
-G_INLINE_FUNC GelETree *
+GelETree *
 gel_matrixw_get_vindex(GelMatrixW *m, int i) {
        int w = gel_matrixw_width(m);
        /* Avoid dividing things */
@@ -1407,4 +1397,3 @@ gel_matrixw_get_vindex(GelMatrixW *m, int i) {
        else
                return gel_matrixw_get_index (m, i % w, i / w);
 }
-#endif
diff --git a/src/matrixw.h b/src/matrixw.h
index 6ca8a50c..d556bcc3 100644
--- a/src/matrixw.h
+++ b/src/matrixw.h
@@ -119,6 +119,12 @@ extern GelETree *the_zero;
        (gel_matrix_index((a)->m, \
                          (a)->regx ? (a)->regx[(a)->tr?(j):(i)] : ((a)->tr?(j):(i)), \
                          (a)->regy ? (a)->regy[(a)->tr?(i):(j)] : ((a)->tr?(i):(j))))
+
+#define gel_matrixw_set_indexii(a,i) \
+       (gel_matrix_index((a)->m, \
+                         (a)->regx ? (a)->regx[i] : (i), \
+                         (a)->regy ? (a)->regy[i] : (i)))
+
 /* Just like set (can return NULL) but can't be used as lvalue */
 #define gel_matrixw_get_index(a,i,j) \
        ((a)->tr ? \
@@ -128,57 +134,23 @@ extern GelETree *the_zero;
         (gel_matrix_index((a)->m, \
                          (a)->regx ? (a)->regx[i] : (i), \
                          (a)->regy ? (a)->regy[j] : (j))))
+#define gel_matrixw_get_indexii(a,i) \
+        (gel_matrix_index((a)->m, \
+                         (a)->regx ? (a)->regx[i] : (i), \
+                         (a)->regy ? (a)->regy[i] : (i)))
 
 #define gel_matrixw_width(a) ((a)->tr?(a)->regh:(a)->regw)
 #define gel_matrixw_height(a) ((a)->tr?(a)->regw:(a)->regh)
 #define gel_matrixw_elements(a) ((a)->regw*(a)->regh)
 
 /*get the value at, make sure it's in the range*/
-G_INLINE_FUNC GelETree *gel_matrixw_index(GelMatrixW *m, int x, int y) G_GNUC_PURE;
-/* Keep up to date with the one in the .c file */
-#ifdef G_CAN_INLINE
-G_INLINE_FUNC GelETree *
-gel_matrixw_index(GelMatrixW *m, int x, int y) {
-       GelETree *t = gel_matrixw_get_index (m, x, y);
-       return t?t:the_zero;
-}
-#endif
+GelETree *gel_matrixw_index(GelMatrixW *m, int x, int y) G_GNUC_PURE;
 
 /*get the value at, make sure it's in the range*/
-G_INLINE_FUNC GelETree *gel_matrixw_vindex(GelMatrixW *m, int i) G_GNUC_PURE;
-/* Keep up to date with the one in the .c file */
-#ifdef G_CAN_INLINE
-G_INLINE_FUNC GelETree *
-gel_matrixw_vindex(GelMatrixW *m, int i) {
-       GelETree *t;
-       int w = gel_matrixw_width(m);
-       /* Avoid dividing things */
-       if (w == 1)
-               t = gel_matrixw_index (m, 0, i);
-       else if (gel_matrixw_height(m) == 1)
-               t = gel_matrixw_index (m, i, 0);
-       else
-               t = gel_matrixw_index (m, i % w, i / w);
-       return t ? t : the_zero;
-}
-#endif
+GelETree *gel_matrixw_vindex(GelMatrixW *m, int i) G_GNUC_PURE;
 
 /*get the value at, make sure it's in the range*/
-G_INLINE_FUNC GelETree *gel_matrixw_get_vindex(GelMatrixW *m, int i) G_GNUC_PURE;
-/* Keep up to date with the one in the .c file */
-#ifdef G_CAN_INLINE
-G_INLINE_FUNC GelETree *
-gel_matrixw_get_vindex(GelMatrixW *m, int i) {
-       int w = gel_matrixw_width(m);
-       /* Avoid dividing things */
-       if (w == 1)
-               return gel_matrixw_get_index (m, 0, i);
-       else if (gel_matrixw_height(m) == 1)
-               return gel_matrixw_get_index (m, i, 0);
-       else
-               return gel_matrixw_get_index (m, i % w, i / w);
-}
-#endif
+GelETree *gel_matrixw_get_vindex(GelMatrixW *m, int i) G_GNUC_PURE;
 
 #define GEL_MATRIXW_VINDEX_TO_INDEX(m,i,x,y) \
        { \
diff --git a/src/mpwrap.c b/src/mpwrap.c
index 66a1b8bd..7e2b1bdb 100644
--- a/src/mpwrap.c
+++ b/src/mpwrap.c
@@ -286,14 +286,14 @@ static void mpwl_make_type(MpwRealNum *op,int type);
 /*make new type and clear the old one*/
 static void mpwl_make_same_type(MpwRealNum *op1,MpwRealNum *op2);
 
-static inline void mpwl_clear(MpwRealNum *op);
+static void mpwl_clear(MpwRealNum *op);
 
-static inline void mpwl_init_type(MpwRealNum *op,int type);
+static void mpwl_init_type(MpwRealNum *op,int type);
 
-static inline void mpwl_free(MpwRealNum *op);
+static void mpwl_free(MpwRealNum *op);
 
-static inline int mpwl_sgn (MpwRealNum *op) G_GNUC_PURE;
-static inline int mpwl_zero_p (MpwRealNum *op) G_GNUC_PURE;
+static int mpwl_sgn (MpwRealNum *op) G_GNUC_PURE;
+static int mpwl_zero_p (MpwRealNum *op) G_GNUC_PURE;
 
 static long mpwl_get_exp(MpwRealNum *op);
 
@@ -614,7 +614,7 @@ mpwl_make_same_type(MpwRealNum *op1,MpwRealNum *op2)
                mpwl_make_type(op1,op2->type);
 }
 
-static inline void
+static void
 mpwl_clear (MpwRealNum *op)
 {
        if G_UNLIKELY (op == NULL)
@@ -636,7 +636,7 @@ mpwl_clear (MpwRealNum *op)
        }
 }
 
-static inline void
+static void
 mpwl_init_type(MpwRealNum *op,int type)
 {
        if G_UNLIKELY (op == NULL)
@@ -660,7 +660,7 @@ mpwl_init_type(MpwRealNum *op,int type)
        }
 }
 
-static inline void
+static void
 mpwl_free(MpwRealNum *op)
 {
        if G_UNLIKELY (op == NULL)
@@ -687,7 +687,7 @@ mpwl_sgn(MpwRealNum *op)
        }
 }
 
-static inline int
+static int
 mpwl_zero_p (MpwRealNum *op) /* PURE!*/
 {
        switch(op->type) {
@@ -2442,7 +2442,7 @@ mpwl_catalan_constant (MpwRealNum *rop)
 static gmp_randstate_t rand_state;
 static gboolean rand_state_inited = FALSE;
 
-static inline void
+static void
 init_randstate (void)
 {
        if G_UNLIKELY ( ! rand_state_inited) {
@@ -2514,7 +2514,7 @@ mpwl_randint (MpwRealNum *rop, MpwRealNum *op)
        mpz_urandomm (rop->data.ival, rand_state, op->data.ival);
 }
 
-static inline void
+static void
 mpwl_make_int(MpwRealNum *rop)
 {
        switch(rop->type) {
@@ -2888,7 +2888,7 @@ str_format_float (char *p,
 
        if(((e-1)<min_exp || (e-1)>max_exp) || scientific_notation) {
                if (e != 0)
-                       p = g_realloc (p, len+2+((int)log10(abs(e))+2)+1);
+                       p = g_realloc (p, len+2+((int)log10(e > 0 ? e : -e)+2)+1);
                else
                        p = g_realloc (p, len + 4);
                        
@@ -4041,29 +4041,29 @@ mpw_invert (mpw_ptr rop, mpw_ptr op1, mpw_ptr mod)
                        }
                }
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't do modulo invert on complex numbers"));
        }
 }
 
 void
-mpw_gcd(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
+mpw_gcd (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
-               MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               MAKE_REAL (rop);
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
                }
-               mpwl_gcd(rop->r,op1->r,op2->r);
+               mpwl_gcd (rop->r, op1->r, op2->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't GCD complex numbers"));
        }
 }
 void
-mpw_lcm (mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
+mpw_lcm (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
                MpwRealNum gcd = {{NULL}};
@@ -4076,7 +4076,7 @@ mpw_lcm (mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
                }
 
                MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
@@ -4087,59 +4087,62 @@ mpw_lcm (mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
                if (mpwl_sgn (rop->r) < 0)
                        mpwl_neg (rop->r, rop->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't LCM complex numbers"));
        }
 }
 
 void
-mpw_jacobi(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
+mpw_jacobi (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
                MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
                }
                mpwl_jacobi(rop->r,op1->r,op2->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't get Jacobi symbols of complex numbers"));
        }
 }
+
 void
 mpw_legendre(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
                MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
                }
                mpwl_legendre(rop->r,op1->r,op2->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't get Legendre symbols of complex numbers"));
        }
 }
+
 void
-mpw_kronecker(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
+mpw_kronecker (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
                MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
                }
                mpwl_kronecker(rop->r,op1->r,op2->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("Can't get Jacobi symbol with Kronecker extension for complex numbers"));
        }
 }
+
 void
 mpw_lucnum (mpw_ptr rop, mpw_ptr op)
 {
@@ -4329,7 +4332,7 @@ backup_mpw_pow:
 }
 
 void
-mpw_powm(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2, mpw_ptr mod)
+mpw_powm (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2, mpw_ptr mod)
 {
        if G_UNLIKELY (MPW_IS_COMPLEX (op1) ||
                       MPW_IS_COMPLEX (op2) ||
@@ -4341,7 +4344,7 @@ mpw_powm(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2, mpw_ptr mod)
        }
 
        MAKE_REAL (rop);
-       if (rop != op1 && rop != op1 && rop != mod) {
+       if (rop != op1 && rop != op2 && rop != mod) {
                MAKE_EMPTY (rop->r, MPW_INTEGER);
        } else {
                MAKE_COPY (rop->r);
@@ -4904,18 +4907,18 @@ mpw_arctan(mpw_ptr rop,mpw_ptr op)
 }
 
 void
-mpw_arctan2(mpw_ptr rop,mpw_ptr op1, mpw_ptr op2)
+mpw_arctan2 (mpw_ptr rop, mpw_ptr op1, mpw_ptr op2)
 {
        if G_LIKELY (MPW_IS_REAL (op1) && MPW_IS_REAL (op2)) {
-               MAKE_REAL(rop);
-               if (rop != op1 && rop != op1) {
+               MAKE_REAL (rop);
+               if (rop != op1 && rop != op2) {
                        MAKE_EMPTY (rop->r, MPW_INTEGER);
                } else {
                        MAKE_COPY (rop->r);
                }
-               mpwl_arctan2(rop->r,op1->r,op2->r);
+               mpwl_arctan2 (rop->r, op1->r, op2->r);
        } else {
-               gel_error_num=GEL_NUMERICAL_MPW_ERROR;
+               gel_error_num = GEL_NUMERICAL_MPW_ERROR;
                gel_errorout (_("arctan2 not defined for complex numbers"));
        }
 }
diff --git a/src/parse.y b/src/parse.y
index fe488749..435c50f0 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -40,7 +40,7 @@ extern gboolean gel_return_ret; /*should the lexer return on \n*/
 
 /* prototype for yylex */
 int yylex(void);
-void yyerror(char *);
+void yyerror(const char *);
 
 %}
 
diff --git a/src/plugin.c b/src/plugin.c
index 3a32cfee..237a4f19 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -111,8 +111,7 @@ gel_read_plugin_list (void)
        char *datadir;
 
        /*free the previous list*/
-       g_slist_foreach (gel_plugin_list, (GFunc)free_plugin, NULL);
-       g_slist_free (gel_plugin_list);
+       g_slist_free_full (gel_plugin_list, (GDestroyNotify)free_plugin);
        gel_plugin_list = NULL;
        
        datadir = gbr_find_data_dir (DATADIR);
diff --git a/src/structs.h b/src/structs.h
index 8b2da908..99e3b421 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -146,8 +146,8 @@ typedef enum {
        GEL_NULL_NODE=0,
        GEL_VALUE_NODE,
        GEL_MATRIX_NODE,
-       GEL_SET_NODE, /* FIXME: Note implemented */
-       GEL_POLYNOMIAL_NODE, /* FIXME: Note implemented */
+       GEL_SET_NODE, /* FIXME: Not implemented */
+       GEL_POLYNOMIAL_NODE, /* FIXME: Not implemented */
        GEL_OPERATOR_NODE,
        GEL_IDENTIFIER_NODE,
        GEL_STRING_NODE,
diff --git a/ve/ve-config.c b/ve/ve-config.c
index 55940529..88406e5e 100644
--- a/ve/ve-config.c
+++ b/ve/ve-config.c
@@ -116,8 +116,7 @@ destroy_section (VeSection *section)
        g_free (section->name);
        section->name = NULL;
 
-       g_list_foreach (section->lines, (GFunc) destroy_line, NULL);
-       g_list_free (section->lines);
+       g_list_free_full (section->lines, (GDestroyNotify) destroy_line);
        section->lines = NULL;
 
        g_free (section);
@@ -433,8 +432,8 @@ ve_config_new (const char *file)
 {
        VeConfig *config;
 
-       g_return_val_if_fail (file != NULL, NULL);
-       
+       g_assert (file != NULL);
+
        config = g_new0 (VeConfig, 1);
 
        config->file = g_strdup (file);
@@ -475,8 +474,7 @@ config_clear (VeConfig *config)
 
        destroy_section (config->root);
 
-       g_list_foreach (config->sections, (GFunc) destroy_section, NULL);
-       g_list_free (config->sections);
+       g_list_free_full (config->sections, (GDestroyNotify) destroy_section);
        config->sections = NULL;
 
        g_hash_table_destroy (config->line_ht);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]