Remove variables assigned to but never used.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Sep 2012 22:36:50 +0000 (15:36 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Sep 2012 04:20:51 +0000 (21:20 -0700)
Each of the variables removed here was assigned a value that was
never used, the assignment didn't have any useful side effects, and
I don't see anything that the variable should have been used for.

Found by GCC 4.7.

15 files changed:
lib/gtk-contrib/psppire-sheet.c
src/data/data-in.c
src/language/control/repeat.c
src/language/expressions/evaluate.c
src/language/stats/factor.c
src/language/stats/quick-cluster.c
src/libpspp/range-tower.c
src/output/cairo.c
src/ui/gui/customentry.c
src/ui/gui/pspp-sheet-view.c
src/ui/gui/psppire-dialog-action-rank.c
src/ui/gui/psppire-dialog.c
src/ui/gui/psppire-dictview.c
src/ui/gui/psppire-syntax-window.c
tests/libpspp/heap-test.c

index 7f4c1fed416caa306682488a751c03557e0da674..0819bb31749c7afed6069d56f71bbc4fabb8124d 100644 (file)
@@ -1698,13 +1698,9 @@ psppire_sheet_set_scroll_adjustments (PsppireSheet *sheet,
 static void
 psppire_sheet_finalize (GObject *object)
 {
-  PsppireSheet *sheet;
-
   g_return_if_fail (object != NULL);
   g_return_if_fail (PSPPIRE_IS_SHEET (object));
 
-  sheet = PSPPIRE_SHEET (object);
-
   if (G_OBJECT_CLASS (parent_class)->finalize)
     (*G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
@@ -4141,7 +4137,7 @@ draw_button (PsppireSheet *sheet, GdkWindow *window,
             GdkRectangle allocation)
 {
   GtkShadowType shadow_type;
-  gint text_width = 0, text_height = 0;
+  gint text_width = 0;
   PangoAlignment align = PANGO_ALIGN_LEFT;
 
   gboolean rtl ;
@@ -4206,9 +4202,6 @@ draw_button (PsppireSheet *sheet, GdkWindow *window,
 
   if (button->label_visible)
     {
-      text_height = DEFAULT_ROW_HEIGHT -
-       2 * COLUMN_TITLES_HEIGHT;
-
       gdk_gc_set_clip_rectangle (GTK_WIDGET (sheet)->style->fg_gc[button->state],
                                 &allocation);
       gdk_gc_set_clip_rectangle (GTK_WIDGET (sheet)->style->white_gc,
index 14a24fffe26d367497e9262fd9daa1a0709a68c0..5d4496cf9085de0d54509f224a89e0b0261935d1 100644 (file)
@@ -281,7 +281,6 @@ parse_number (struct data_in *i)
 
   struct string tmp;
 
-  bool explicit_decimals = false;
   int save_errno;
   char *tail;
 
@@ -334,7 +333,6 @@ parse_number (struct data_in *i)
   /* Decimal point and following digits. */
   if (ss_match_byte (&i->input, style->decimal))
     {
-      explicit_decimals = true;
       ds_put_byte (&tmp, '.');
       while (c_isdigit (ss_first (i->input)))
         ds_put_byte (&tmp, ss_get_byte (&i->input));
@@ -345,7 +343,6 @@ parse_number (struct data_in *i)
       && !ss_is_empty (i->input)
       && strchr ("eEdD-+", ss_first (i->input)))
     {
-      explicit_decimals = true;
       ds_put_byte (&tmp, 'e');
 
       if (strchr ("eEdD", ss_first (i->input)))
index 4f63ec69bade5f437538dc30515b3e225545fb64..72d45c2c2ff96344cfe65c3948475fd661792469 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2007, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -249,7 +249,6 @@ parse_commands (struct lexer *lexer, struct hmap *dummies)
   enum segmenter_mode mode;
   struct string *outputs;
   struct string input;
-  size_t input_len;
   size_t n_values;
   char *file_name;
   int line_number;
@@ -272,7 +271,6 @@ parse_commands (struct lexer *lexer, struct hmap *dummies)
   if (ds_is_empty (&input))
     ds_put_byte (&input, '\n');
   ds_put_byte (&input, '\0');
-  input_len = ds_length (&input);
 
   n_values = count_values (dummies);
   outputs = xmalloc (n_values * sizeof *outputs);
index 84236b8c9f76d17a72820b733bea6b6a11f34c52..afb742ffeae06de29b57ba327bd85a41a753aaeb 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -132,7 +132,6 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED)
       else if (lex_match (lexer, T_LPAREN))
         {
           struct variable *v;
-          size_t old_value_cnt;
           int width;
 
           if (!lex_force_id (lexer))
@@ -159,7 +158,6 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED)
              d = dataset_dict (ds);
            }
 
-          old_value_cnt = dict_get_next_value_idx (d);
           v = dict_create_var (d, name, width);
           if (v == NULL)
             {
index 89c1e2f58ae7cc734bc29c61ec8d4a68d9cd0a65..f3933268431c646e70ed741fd74b7856567ab011 100644 (file)
@@ -813,7 +813,6 @@ static bool run_factor (struct dataset *ds, const struct cmd_factor *factor);
 int
 cmd_factor (struct lexer *lexer, struct dataset *ds)
 {
-  bool extraction_seen = false;
   const struct dictionary *dict = dataset_dict (ds);
 
   struct cmd_factor factor;
@@ -998,7 +997,6 @@ cmd_factor (struct lexer *lexer, struct dataset *ds)
        }
       else if (lex_match_id (lexer, "EXTRACTION"))
        {
-         extraction_seen = true;
           lex_match (lexer, T_EQUALS);
           while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
            {
index e6987f4b10b5db503a799b66665a796665407a17..bc66cce795caf06932ed3da6269b306bd0a6cd52 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -390,11 +390,10 @@ static void
 quick_cluster_show_centers (struct Kmeans *kmeans, bool initial, const struct qc *qc)
 {
   struct tab_table *t;
-  int nc, nr, heading_columns, currow;
+  int nc, nr, currow;
   int i, j;
   nc = qc->ngroups + 1;
   nr = qc->n_vars + 4;
-  heading_columns = 1;
   t = tab_create (nc, nr);
   tab_headers (t, 0, nc - 1, 0, 1);
   currow = 0;
index 9d9f8aaa841ec05e3ae9d686ae2dabede44a88a1..a6548e42c13b122403599da248c352873053ee1f 100644 (file)
@@ -1,5 +1,5 @@
 /* pspp - a program for statistical analysis.
-   Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -741,7 +741,6 @@ range_tower_move (struct range_tower *rt,
                   unsigned long int width)
 {
   unsigned long int node_start;
-  int i;
 
   if (width == 0 || old_start == new_start)
     return;
@@ -749,7 +748,6 @@ range_tower_move (struct range_tower *rt,
   assert (old_start + width - 1 >= old_start);
   assert (new_start + width - 1 >= new_start);
 
-  i = 0;
   do
     {
       struct range_tower_node *node;
index da5740464e58c2c5a056d4be36c4c4d815375910..b786733448ea003382225a2452b575dd10ca8f0e 100644 (file)
@@ -386,14 +386,12 @@ xr_create (const char *file_name, enum settings_output_devices device_type,
            struct string_map *o, enum xr_output_type file_type)
 {
   enum { MIN_WIDTH = 3, MIN_LENGTH = 3 };
-  struct output_driver *d;
   struct xr_driver *xr;
   cairo_surface_t *surface;
   cairo_status_t status;
   double width_pt, length_pt;
 
   xr = xr_allocate (file_name, device_type, o);
-  d = &xr->driver;
 
   width_pt = (xr->width + xr->left_margin + xr->right_margin) / 1000.0;
   length_pt = (xr->length + xr->top_margin + xr->bottom_margin) / 1000.0;
index b7d0ce2d27c25eef7d4874e1ef5a178b240fadb3..dc5848ec087b86e338d8c7b25b2487425c15e2ea 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2005, 2007, 2010, 2011  Free Software Foundation
+   Copyright (C) 2005, 2007, 2010, 2011, 2012  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -304,12 +304,10 @@ psppire_custom_entry_class_init (PsppireCustomEntryClass *klass)
   GObjectClass     *gobject_class = G_OBJECT_CLASS (klass);
 
   GtkWidgetClass   *widget_class;
-  GtkEntryClass   *entry_class;
 
   parent_class = g_type_class_peek_parent (klass);
 
   widget_class   = (GtkWidgetClass*)   klass;
-  entry_class   = (GtkEntryClass*)   klass;
 
   widget_class->map = psppire_custom_entry_map;
   widget_class->unmap = psppire_custom_entry_unmap;
index eb7654fab90d904c5cecefaf7b03f280ee06114c..c4eec5637c9e2664d4b3cee3c39840f20b9e59b0 100644 (file)
@@ -2303,7 +2303,6 @@ pspp_sheet_view_button_press (GtkWidget      *widget,
       PsppSheetViewColumn *column = NULL;
       GtkCellRenderer *focus_cell = NULL;
       gboolean row_double_click = FALSE;
-      gboolean node_selected;
 
       /* Empty tree? */
       if (tree_view->priv->row_count == 0)
@@ -2325,7 +2324,6 @@ pspp_sheet_view_button_press (GtkWidget      *widget,
         return TRUE;
 
       /* select */
-      node_selected = pspp_sheet_view_node_is_selected (tree_view, node);
       pre_val = tree_view->priv->vadjustment->value;
 
       path = _pspp_sheet_view_find_path (tree_view, node);
@@ -2391,7 +2389,6 @@ pspp_sheet_view_button_press (GtkWidget      *widget,
           tree_view->priv->press_start_node = node;
 
          if (tree_view->priv->rubber_banding_enable
-             //&& !node_selected
              && (tree_view->priv->selection->type == PSPP_SHEET_SELECTION_MULTIPLE ||
                   tree_view->priv->selection->type == PSPP_SHEET_SELECTION_RECTANGLE))
            {
@@ -3753,7 +3750,6 @@ pspp_sheet_view_bin_expose (GtkWidget      *widget,
   gint new_y;
   gint y_offset, cell_offset;
   gint max_height;
-  gint depth;
   GdkRectangle background_area;
   GdkRectangle cell_area;
   guint flags;
@@ -3826,7 +3822,6 @@ pspp_sheet_view_bin_expose (GtkWidget      *widget,
   gtk_tree_model_get_iter (tree_view->priv->model,
                           &iter,
                           path);
-  depth = gtk_tree_path_get_depth (path);
   gtk_tree_path_free (path);
   
   cursor_path = NULL;
@@ -5003,7 +4998,6 @@ validate_row (PsppSheetView *tree_view,
   gint horizontal_separator;
   gint vertical_separator;
   gint focus_line_width;
-  gboolean retval = FALSE;
   gboolean draw_vgrid_lines, draw_hgrid_lines;
   gint focus_pad;
   gint grid_line_width;
@@ -5066,10 +5060,7 @@ validate_row (PsppSheetView *tree_view,
        }
 
       if (tmp_width > column->requested_width)
-       {
-         retval = TRUE;
-         column->requested_width = tmp_width;
-       }
+        column->requested_width = tmp_width;
     }
 
   if (draw_hgrid_lines)
@@ -8782,7 +8773,6 @@ pspp_sheet_view_set_model (PsppSheetView  *tree_view,
   if (tree_view->priv->model)
     {
       gint i;
-      GtkTreeModelFlags flags;
 
       if (tree_view->priv->search_column == -1)
        {
@@ -8816,8 +8806,6 @@ pspp_sheet_view_set_model (PsppSheetView  *tree_view,
                        G_CALLBACK (pspp_sheet_view_rows_reordered),
                        tree_view);
 
-      flags = gtk_tree_model_get_flags (tree_view->priv->model);
-
       tree_view->priv->row_count = gtk_tree_model_iter_n_children (tree_view->priv->model, NULL);
 
       /*  FIXME: do I need to do this? pspp_sheet_view_create_buttons (tree_view); */
@@ -11021,7 +11009,6 @@ pspp_sheet_view_create_row_drag_icon (PsppSheetView  *tree_view,
   GdkRectangle background_area;
   GdkRectangle expose_area;
   GtkWidget *widget;
-  gint depth;
   /* start drawing inside the black outline */
   gint x = 1, y = 1;
   GdkDrawable *drawable;
@@ -11036,8 +11023,6 @@ pspp_sheet_view_create_row_drag_icon (PsppSheetView  *tree_view,
   if (!gtk_widget_get_realized (widget))
     return NULL;
 
-  depth = gtk_tree_path_get_depth (path);
-
   _pspp_sheet_view_find_node (tree_view,
                             path,
                             &node);
@@ -12407,12 +12392,10 @@ pspp_sheet_view_set_special_cells (PsppSheetView           *tree_view,
                              PsppSheetViewSpecialCells   special_cells)
 {
   PsppSheetViewPrivate *priv;
-  GtkWidget *widget;
 
   g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view));
 
   priv = tree_view->priv;
-  widget = GTK_WIDGET (tree_view);
 
   if (priv->special_cells != special_cells)
     {
index bbf30a61ce0a47420f01bd9b11d186eaaee160ff..f4d59b7be2df5ee77866b7b2af09d2c0c07c14e5 100644 (file)
@@ -169,14 +169,12 @@ run_types_dialog (GtkButton *b, PsppireDialogActionRank *dar)
 {
   PsppireDialogAction *act  = PSPPIRE_DIALOG_ACTION (dar);
 
-  gint response;
-
   gtk_window_set_transient_for (GTK_WINDOW (dar->types_dialog),
                                GTK_WINDOW (act->dialog));
 
   types_dialog_reset (dar);
 
-  response = psppire_dialog_run (PSPPIRE_DIALOG (dar->types_dialog));
+  psppire_dialog_run (PSPPIRE_DIALOG (dar->types_dialog));
 }
 
 static void
@@ -184,12 +182,10 @@ run_ties_dialog (GtkButton *b,  PsppireDialogActionRank *dar)
 {
   PsppireDialogAction *act  = PSPPIRE_DIALOG_ACTION (dar);
 
-  gint response;
-
   gtk_window_set_transient_for (GTK_WINDOW (dar->ties_dialog),
                                GTK_WINDOW (act->dialog));
 
-  response = psppire_dialog_run (PSPPIRE_DIALOG (dar->ties_dialog));
+  psppire_dialog_run (PSPPIRE_DIALOG (dar->ties_dialog));
 }
 
 static void
index 547ff2a4da25c155411b177fbc8ded3ce8ff943b..ee44512f645b27cc1f92aee1752282311d962a2e 100644 (file)
@@ -89,13 +89,9 @@ static GObjectClass     *parent_class = NULL;
 static void
 psppire_dialog_finalize (GObject *object)
 {
-  PsppireDialog *dialog ;
-
   g_return_if_fail (object != NULL);
   g_return_if_fail (PSPPIRE_IS_DIALOG (object));
 
-  dialog = PSPPIRE_DIALOG (object);
-
   if (G_OBJECT_CLASS (parent_class)->finalize)
     G_OBJECT_CLASS (parent_class)->finalize (object);
 }
index 023be7d0cc7311e9ce1643512a5ec04431d5d92c..5554eb0adebf9cbd8ea9a701461e3f7c72eed9b2 100644 (file)
@@ -305,12 +305,9 @@ var_description_cell_data_func (GtkTreeViewColumn *col,
   struct variable *var;
   GtkTreeIter iter;
   GtkTreeModel *model;
-  PsppireDict *dict;
 
   dv_get_base_model (top_model, top_iter, &model, &iter);
 
-  dict = PSPPIRE_DICT (model);
-
   gtk_tree_model_get (model,
                      &iter, DICT_TVM_COL_VAR, &var, -1);
 
@@ -414,10 +411,8 @@ set_tooltip_for_variable (GtkTreeView  *treeview,
   {
     const gchar *tip ;
     GtkTreeModel *m;
-    PsppireDict *dict;
 
     dv_get_base_model (tree_model, NULL, &m, NULL);
-    dict = PSPPIRE_DICT (m);
 
     if ( PSPPIRE_DICT_VIEW (treeview)->prefer_labels )
       tip = var_get_name (var);
index c68ad44553daaaa59f75def7d329ed01872ac880..0c05fdc58e167436ac0419faaf118ca894f3f200 100644 (file)
@@ -376,7 +376,6 @@ contents_received_callback (GtkClipboard *clipboard,
                            GtkSelectionData *sd,
                            gpointer data)
 {
-  gchar *c;
   PsppireSyntaxWindow *syntax_window = data;
 
   if ( sd->length < 0 )
@@ -385,8 +384,6 @@ contents_received_callback (GtkClipboard *clipboard,
   if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE))
     return;
 
-  c = (gchar *) sd->data;
-
   gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (syntax_window->buffer),
                                    (gchar *) sd->data,
                                    sd->length);
index d042ab5c3860d8571da151bb97757f52d6912164..639bf94002d80a15fd4bd77240e8f49c033b8975 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2010, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -524,11 +524,7 @@ test_inc_dec (void)
             delete[i] = insert[i];
           for (i = 0; i < cnt; i++)
             {
-              int old_value, old_min, new_min;
-              old_min = min_int (delete, cnt);
-              old_value = delete[i];
               elements[i].x = delete[i] = rand () % (cnt + 2) - 1;
-              new_min = min_int (delete, cnt);
               heap_changed (h, &elements[i].node);
               check (heap_node_to_element (heap_minimum (h))->x
                      == min_int (delete, cnt));
@@ -595,7 +591,6 @@ test_random_insert_delete (void)
       if (action == INSERT)
         {
           int new_value;
-          int old_min;
 
           new_value = rand () % max_elems;
           values[cnt] = new_value;
@@ -603,20 +598,13 @@ test_random_insert_delete (void)
 
           heap_insert (h, &elements[cnt].node);
 
-          old_min = min_int (values, cnt);
-
           cnt++;
         }
       else if (action == DELETE)
         {
           int del_idx;
-          int del_value;
-          int old_min, new_min;
-
-          old_min = min_int (values, cnt);
 
           del_idx = rand () % cnt;
-          del_value = values[del_idx];
           heap_delete (h, &elements[del_idx].node);
 
           cnt--;
@@ -626,8 +614,6 @@ test_random_insert_delete (void)
               elements[del_idx] = elements[cnt];
               heap_moved (h, &elements[del_idx].node);
             }
-
-          new_min = min_int (values, cnt);
         }
       else
         abort ();