gui: Fix warnings from g_string_free(..., FALSE).
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 4 May 2023 14:57:46 +0000 (07:57 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 4 May 2023 14:57:46 +0000 (07:57 -0700)
This construct now causes a warning about an unused return value, so this
commit replaces it in each case with g_string_free_and_steal(), which also
leads to clearer code.

32 files changed:
src/ui/gui/psppire-dialog-action-1sks.c
src/ui/gui/psppire-dialog-action-aggregate.c
src/ui/gui/psppire-dialog-action-autorecode.c
src/ui/gui/psppire-dialog-action-barchart.c
src/ui/gui/psppire-dialog-action-comments.c
src/ui/gui/psppire-dialog-action-compute.c
src/ui/gui/psppire-dialog-action-correlation.c
src/ui/gui/psppire-dialog-action-crosstabs.c
src/ui/gui/psppire-dialog-action-descriptives.c
src/ui/gui/psppire-dialog-action-examine.c
src/ui/gui/psppire-dialog-action-flip.c
src/ui/gui/psppire-dialog-action-histogram.c
src/ui/gui/psppire-dialog-action-indep-samps.c
src/ui/gui/psppire-dialog-action-k-independent.c
src/ui/gui/psppire-dialog-action-k-related.c
src/ui/gui/psppire-dialog-action-kmeans.c
src/ui/gui/psppire-dialog-action-logistic.c
src/ui/gui/psppire-dialog-action-means.c
src/ui/gui/psppire-dialog-action-paired.c
src/ui/gui/psppire-dialog-action-rank.c
src/ui/gui/psppire-dialog-action-regression.c
src/ui/gui/psppire-dialog-action-reliability.c
src/ui/gui/psppire-dialog-action-roc.c
src/ui/gui/psppire-dialog-action-runs.c
src/ui/gui/psppire-dialog-action-sort.c
src/ui/gui/psppire-dialog-action-split.c
src/ui/gui/psppire-dialog-action-tt1s.c
src/ui/gui/psppire-dialog-action-two-sample.c
src/ui/gui/psppire-dialog-action-univariate.c
src/ui/gui/psppire-dialog-action-var-info.c
src/ui/gui/var-display.c
src/ui/gui/widget-io.c

index f0654c6b714f0c8a400ad18b8a9fe6a0d6bd22b1..13b04c6da6d022b17b425b92e06c5d125b0a80c1 100644 (file)
@@ -55,7 +55,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogAction1sks *rd = PSPPIRE_DIALOG_ACTION_1SKS (act);
-  gchar *text;
 
   GString *string = g_string_new ("NPAR TEST");
 
@@ -73,11 +72,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index a95c8c651642de19564ad28458a84b506b37096a..bd78d4ecdad68699c5bbf1c17a23c91d6fc379af 100644 (file)
@@ -99,8 +99,6 @@ generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionAggregate *agg = PSPPIRE_DIALOG_ACTION_AGGREGATE (act);
 
-  gchar *text;
-
   GString *string = g_string_new ("AGGREGATE OUTFILE=");
 
   append_destination_filename (agg, string);
@@ -116,11 +114,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 2f1bdcbecbe7986ebd12e7b984b4d69bcd4fd0f6..078927255720a9ebc724d9f09a3e1cb13c1f4f76 100644 (file)
@@ -119,7 +119,6 @@ generate_syntax (const PsppireDialogAction *act)
 
   GHashTableIter iter;
   gpointer key, value;
-  gchar *text;
 
   GString *string = g_string_new ("AUTORECODE");
 
@@ -154,11 +153,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index b46ba1b7dd811e25af77341af0fb79b8ae7af5c8..576ed18a5afd496db9812524d4fb00989c4c7dae 100644 (file)
@@ -154,7 +154,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionBarchart *rd = PSPPIRE_DIALOG_ACTION_BARCHART (a);
-  gchar *text;
   const gchar *var_name_xaxis = gtk_entry_get_text (GTK_ENTRY (rd->variable_xaxis));
   const gchar *var_name_cluster = gtk_entry_get_text (GTK_ENTRY (rd->variable_cluster));
 
@@ -214,11 +213,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index eeb512d9494eaa3c07cc1a198eeec6de38fa5071..9a423c720d4d12ce9751defe53accf3ca0f201d2 100644 (file)
@@ -42,7 +42,6 @@ generate_syntax (const PsppireDialogAction *pda)
   gint i;
 
   GString *str;
-  gchar *text;
   GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (cd->textview));
 
   str = g_string_new ("\n* Data File Comments.\n\n");
@@ -82,11 +81,7 @@ generate_syntax (const PsppireDialogAction *pda)
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->check)))
     g_string_append (str, "DISPLAY DOCUMENTS.\n");
 
-  text = str->str;
-
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 
index 23c0108406cdae56c8fd02dad461ce9bb96c7845..78a036d88aaf82b453225e9788f361bc24657e9f 100644 (file)
@@ -38,7 +38,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionCompute *cd = PSPPIRE_DIALOG_ACTION_COMPUTE (act);
-  gchar *text;
   GString *string;
 
   const gchar *target_name ;
@@ -88,11 +87,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, "EXECUTE.\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 18cba1c09a0162786b632d88b3955a48a45c14ba..1653def0f06a3480eea2b093df70b7ba8aaca001 100644 (file)
@@ -33,7 +33,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionCorrelation *rd = PSPPIRE_DIALOG_ACTION_CORRELATION (act);
-  gchar *text;
   GString *string = g_string_new ("CORRELATION");
   g_string_append (string, "\n\t/VARIABLES = ");
 
@@ -56,11 +55,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 3c2bd5957943a142efd149ded6942268efd2a08b..6b26775d71e329ca40cfb4e429dbff5677311cfa 100644 (file)
@@ -271,7 +271,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionCrosstabs *cd = PSPPIRE_DIALOG_ACTION_CROSSTABS (a);
-  gchar *text = NULL;
   int i, n;
   guint selected;
   GString *string = g_string_new ("CROSSTABS ");
@@ -358,11 +357,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index a2a554a47168ed985b77d22a28ffb84af52e963f..38f63b02f5b7e9d79febf0aaf2db9b8a3ef79152 100644 (file)
@@ -77,7 +77,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionDescriptives *scd = PSPPIRE_DIALOG_ACTION_DESCRIPTIVES (act);
-  gchar *text;
   GString *string;
   GtkTreeIter iter;
   unsigned int selected;
@@ -149,11 +148,7 @@ generate_syntax (const PsppireDialogAction *act)
   if (gtk_toggle_button_get_active (scd->save_z_scores))
     g_string_append (string, "\nEXECUTE.");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static gboolean
index b81a2429d59dc4490b3f1f396eb49aacc62a2163..36e8505ffb357f3d2e49d9719cf7b634504b4c52 100644 (file)
@@ -218,7 +218,6 @@ generate_syntax (const PsppireDialogAction *act)
   PsppireDialogActionExamine *ed  = PSPPIRE_DIALOG_ACTION_EXAMINE (act);
 
   const char *label;
-  gchar *text = NULL;
   GString *str = g_string_new ("EXAMINE ");
   bool show_stats = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->display_stats_button));
   bool show_plots = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->display_plots_button));
@@ -334,11 +333,8 @@ generate_syntax (const PsppireDialogAction *act)
     };
 
   g_string_append (str, ".");
-  text = str->str;
 
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 static gboolean
index 07863ec15564369467fde2e0727ec0153968de41..b5c39a9409d23ffe62d4e2347697a223ace4f498 100644 (file)
@@ -40,7 +40,6 @@ generate_syntax (const PsppireDialogAction *act)
   PsppireDialogActionFlip *rd = PSPPIRE_DIALOG_ACTION_FLIP (act);
 
   GString *string = g_string_new ("FLIP");
-  gchar *syntax ;
 
   g_string_append (string, " /VARIABLES = ");
 
@@ -53,11 +52,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  syntax = string->str;
-
-  g_string_free (string, FALSE);
-
-  return syntax;
+  return g_string_free_and_steal (string);
 }
 
 
index f99000ac2898767180c2663e15971329effe02c2..99b07b2846b5f3d3e6eb8bf73d66197af594571e 100644 (file)
@@ -89,7 +89,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionHistogram *rd = PSPPIRE_DIALOG_ACTION_HISTOGRAM (a);
-  gchar *text;
   const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (rd->variable));
   GString *string = g_string_new ("GRAPH /HISTOGRAM ");
 
@@ -103,11 +102,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index 974c1e97f9935ba145859aa34b8dbd9c16c71b22..c52976e3ae6d7902792fac82b76c7347198a15cb 100644 (file)
@@ -362,7 +362,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionIndepSamps *act = PSPPIRE_DIALOG_ACTION_INDEP_SAMPS (a);
-  gchar *text;
 
   GString *str = g_string_new ("T-TEST /VARIABLES=");
 
@@ -415,11 +414,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (str, ".\n");
 
-  text = str->str;
-
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 static void
index e959a093273db7b12c58330d4f71f2c6d49fee77..e3c0487b7d856668a05309c7a4ef5acaebd9a702 100644 (file)
@@ -48,7 +48,6 @@ static const char *keyword[n_KIDS] =
 static char *
 generate_syntax (const PsppireDialogAction *act)
 {
-  gchar *text;
   PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (act);
 
   GString *string = g_string_new ("NPAR TEST");
@@ -77,11 +76,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index a9ef4cbfb27746b635cc63049a46b09b17582dee..d3107d386c98fc94f99a32263291906e0c43dabf 100644 (file)
@@ -33,7 +33,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionKRelated *krd = PSPPIRE_DIALOG_ACTION_K_RELATED (act);
-  gchar *text;
 
   GString *string = g_string_new ("NPAR TEST");
 
@@ -57,11 +56,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 0e22be6e05ca0818c4ca533296792224041d52e6..9279890eec3948bdf83122c4add98ecde1bce82f 100644 (file)
@@ -34,7 +34,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionKmeans *km = PSPPIRE_DIALOG_ACTION_KMEANS (act);
-  gchar *text;
 
   GString *string = g_string_new ("QUICK CLUSTER ");
 
@@ -45,11 +44,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static gboolean
index 252bf9797aa3af6eb74691c72bc85667f250867c..962a0d5469a458ae88587d0bf0ecdbe59a659034 100644 (file)
@@ -148,7 +148,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionLogistic *rd = PSPPIRE_DIALOG_ACTION_LOGISTIC (a);
-  gchar *text = NULL;
 
   const gchar *dep = gtk_entry_get_text (GTK_ENTRY (rd->dep_var));
 
@@ -211,11 +210,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (strx, ".\n");
 
-  text = strx->str;
-
-  g_string_free (strx, FALSE);
-
-  return text;
+  return g_string_free_and_steal (strx);
 }
 
 static void
index c9b7eb8f65f41fb1e83e24a387d4b126996c6f69..c37d978a4ae3af38a7d697dcbba54d0266d6c8da 100644 (file)
@@ -40,7 +40,6 @@ generate_syntax (const PsppireDialogAction *act)
 {
   gint l;
   PsppireDialogActionMeans *scd = PSPPIRE_DIALOG_ACTION_MEANS (act);
-  gchar *text;
   GString *string = g_string_new ("MEANS TABLES = ");
   PsppireMeansLayer *layer = PSPPIRE_MEANS_LAYER (scd->layer);
   psppire_var_view_append_names (PSPPIRE_VAR_VIEW (scd->variables), 0, string);
@@ -62,11 +61,8 @@ generate_syntax (const PsppireDialogAction *act)
     }
 
   g_string_append (string, ".\n");
-  text = string->str;
 
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static gboolean
index 4d2fbb3aee06f2b9a3c13f02af2fcb297fa5a959..f7b33dfb219dd057621396ca643a7d39a71345e0 100644 (file)
@@ -127,7 +127,6 @@ static gchar *
 generate_syntax (const PsppireDialogAction *pda)
 {
   PsppireDialogActionPaired *d = PSPPIRE_DIALOG_ACTION_PAIRED (pda);
-  gchar *text = NULL;
   GString *str =   g_string_new ("T-TEST \n\tPAIRS = ");
 
   psppire_var_view_append_names (PSPPIRE_VAR_VIEW (d->pairs_treeview), 0, str);
@@ -143,10 +142,7 @@ generate_syntax (const PsppireDialogAction *pda)
 
   g_string_append (str, ".\n");
 
-  text = str->str;
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 static GtkBuilder *
index c0454d10f3b86a1855bad7faad9493a227dda7c8..dcb045a3ef778d3036f4cbabdda7ae1c09f922b0 100644 (file)
@@ -40,7 +40,6 @@ generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionRank *rd  = PSPPIRE_DIALOG_ACTION_RANK (act);
 
-  gchar *text = NULL;
   GtkTreeModel *gs = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->group_vars));
 
   GtkTreeIter notused;
@@ -116,11 +115,8 @@ generate_syntax (const PsppireDialogAction *act)
 
 
   g_string_append (str, ".");
-  text = str->str;
 
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 static gboolean
index c3f2234c1cf30559a935d1e5367378fcfd472d1b..7c16cbfadeecc2ba375a40feb6e05db904650ab9 100644 (file)
@@ -189,7 +189,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionRegression *rd = PSPPIRE_DIALOG_ACTION_REGRESSION (a);
-  gchar *text = NULL;
 
   guint selected;
   GtkTreeIter iter;
@@ -241,11 +240,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index 4bb78f9e1e1a089fb0dbf09682849d195e93fc25..e3570c884937e89e74fe7bacb3b62c44d1330b24 100644 (file)
@@ -39,7 +39,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionReliability *rd = PSPPIRE_DIALOG_ACTION_RELIABILITY (act);
-  gchar *text;
   GString *string = g_string_new ("RELIABILITY");
 
   g_string_append (string, "\n\t/VARIABLES=");
@@ -60,11 +59,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 2a8deedd53a34147c789560e4d7a348e102dc3d5..2d194596562e18fccf29189b74a627f25251ac5d 100644 (file)
@@ -159,7 +159,6 @@ static char *
 generate_syntax (const PsppireDialogAction *a)
 {
   PsppireDialogActionRoc *rd = PSPPIRE_DIALOG_ACTION_ROC (a);
-  gchar *text;
   const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (rd->state_variable));
   GString *string = g_string_new ("ROC");
 
@@ -225,11 +224,7 @@ generate_syntax (const PsppireDialogAction *a)
 
   g_string_append (string, ".\n");
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index 3a073e227b05bd215f723aeb834c5e3fe322b8e0..0d06c89f31a984e3ca4c7121c5d2e7f883d88db4 100644 (file)
@@ -54,7 +54,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionRuns *rd = PSPPIRE_DIALOG_ACTION_RUNS (act);
-  gchar *str;
 
   GString *string = g_string_new ("NPAR TEST");
 
@@ -75,11 +74,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (string, ".\n");
 
-  str = string->str;
-
-  g_string_free (string, FALSE);
-
-  return str;
+  return g_string_free_and_steal (string);
 }
 
 
index 7dfb0b278ce895ba3f50ef7fb667e9fb7132d5c1..b34322614dc5020e0fd727b754bf21bf5bad0b01 100644 (file)
@@ -33,7 +33,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionSort *scd = PSPPIRE_DIALOG_ACTION_SORT (act);
-  gchar *text;
   GString *string = g_string_new ("SORT CASES BY ");
 
   PsppireVarView *var_view = PSPPIRE_VAR_VIEW (scd->variables);
@@ -52,11 +51,7 @@ generate_syntax (const PsppireDialogAction *act)
       g_string_append (string, ".");
     }
 
-  text = string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 static void
index 65a322c14cbd26fa83d9967269fac7a048a23195..634e27a7e14ed46c2f19b92595bd099cecc0b6a0 100644 (file)
@@ -39,7 +39,6 @@ static char *
 generate_syntax (const PsppireDialogAction *pda)
 {
   PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
-  gchar *text;
 
   GString *string = g_string_new ("SPLIT FILE OFF.");
 
@@ -73,11 +72,7 @@ generate_syntax (const PsppireDialogAction *pda)
       g_string_free (varlist, TRUE);
     }
 
-  text =  string->str;
-
-  g_string_free (string, FALSE);
-
-  return text;
+  return g_string_free_and_steal (string);
 }
 
 
index 5dd36a65dc106b8607010f0350b4fcb2b3ca48f1..1937a75f0ce2208e3aa30cd8ea5b064ae208faf3 100644 (file)
@@ -35,7 +35,6 @@ static char *
 generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionTt1s *d = PSPPIRE_DIALOG_ACTION_TT1S (act);
-  gchar *text;
 
   GString *str = g_string_new ("T-TEST ");
 
@@ -50,11 +49,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (str, ".\n");
 
-  text = str->str;
-
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 
index 0a2908f944112a9329c2ea8f6b45b3c555e6ed63..7d8c0916ef8fe0521393e8c10e096607c84a15a3 100644 (file)
@@ -139,7 +139,6 @@ generate_syntax (const PsppireDialogAction *pda)
   gint i;
 
   PsppireDialogActionTwoSample *d = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (pda);
-  gchar *text = NULL;
 
   GString *str = g_string_new ("NPAR TEST");
 
@@ -162,10 +161,7 @@ generate_syntax (const PsppireDialogAction *pda)
 
   g_string_append (str, ".\n");
 
-  text = str->str;
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 static GtkBuilder *
index 3d81c7a140f82c2573539bb4c77ed3ff3bbf3b04..6d6c310a620360da1040838bfb97b557368c15c8 100644 (file)
@@ -34,7 +34,6 @@ generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionUnivariate *uvd = PSPPIRE_DIALOG_ACTION_UNIVARIATE (act);
 
-  gchar *text = NULL;
   GString *str = g_string_new ("GLM ");
 
   g_string_append (str, gtk_entry_get_text (GTK_ENTRY (uvd->dep_entry)));
@@ -45,11 +44,7 @@ generate_syntax (const PsppireDialogAction *act)
 
   g_string_append (str, ".\n");
 
-  text = str->str;
-
-  g_string_free (str, FALSE);
-
-  return text;
+  return g_string_free_and_steal (str);
 }
 
 
index 570ce4ada68d54a40b00745517b2fb65fc609829..b4ee58125c707116061e4858358b00e762d16182 100644 (file)
@@ -62,7 +62,6 @@ generate_syntax__ (const PsppireDialogAction *act, const char *prefix)
   size_t n_vars;
   size_t line_len;
   GString *s;
-  char *str;
   size_t i;
 
   psppire_dict_view_get_selected_variables (PSPPIRE_DICT_VIEW (act->source),
@@ -95,9 +94,7 @@ generate_syntax__ (const PsppireDialogAction *act, const char *prefix)
 
   g_free (vars);
 
-  str = s->str;
-  g_string_free (s, FALSE);
-  return str;
+  return g_string_free_and_steal (s);
 }
 
 static gchar *
index 951d62c0a8785e745d1cd96c8c45e1282152d5b0..86a58da7020536ed1ac4647dc90aac41854ac2bd 100644 (file)
@@ -42,10 +42,9 @@ missing_values_to_string (const struct variable *pv, GError **err)
     return xstrdup (gettext (none));
   else
     {
-      gchar *s = NULL;
+      GString *gstr = g_string_sized_new (10);
       if (! mv_has_range (miss))
        {
-         GString *gstr = g_string_sized_new (10);
          const int n = mv_n_values (miss);
          gchar *mv[4] = {0,0,0,0};
          gint i;
@@ -57,12 +56,9 @@ missing_values_to_string (const struct variable *pv, GError **err)
              g_string_append (gstr, mv[i]);
              g_free (mv[i]);
            }
-         s = gstr->str;
-         g_string_free (gstr, FALSE);
        }
       else
        {
-         GString *gstr = g_string_sized_new (10);
          gchar *l, *h;
          union value low, high;
          mv_get_range (miss, &low.f, &high.f);
@@ -84,10 +80,8 @@ missing_values_to_string (const struct variable *pv, GError **err)
              g_string_append (gstr, ss);
              free (ss);
            }
-         s = gstr->str;
-         g_string_free (gstr, FALSE);
        }
 
-      return s;
+      return g_string_free_and_steal (gstr);
     }
 }
index 589eac36ebcef4e797ee6fcb02353499bb37c251..bd28597c118c623bc48017779f07c7eb6db6f67c 100644 (file)
@@ -43,7 +43,6 @@ widget_printf (const gchar *fmt, ...)
   char_directives d;
   arguments a;
   GString *output;
-  gchar *text;
   va_list ap;
   const char *s = fmt;
 
@@ -94,7 +93,5 @@ widget_printf (const gchar *fmt, ...)
   if (*s)
     g_string_append_len (output, s, -1);
 
-  text = output->str;
-  g_string_free (output, FALSE);
-  return text;
+  return g_string_free_and_steal (output);
 }