[genius] Wed Apr 24 16:45:17 2013 Jiri (George) Lebl <jirka 5z com>



commit 62d0ae8d2dc492a4d6e5486b2bed60ad2b93a2bf
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Wed Apr 24 16:45:23 2013 -0500

    Wed Apr 24 16:45:17 2013  Jiri (George) Lebl <jirka 5z com>
    
        * src/parseutil.h, src/funclib.c: properly initialize
          id.uninitialized (ironic huh? :)
    
        * src/graphing.c: use the proper temp directory

 ChangeLog       |    7 +++++++
 src/funclib.c   |    3 +++
 src/graphing.c  |   13 +++++++++++--
 src/parseutil.h |    1 +
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da3c603..d6b05a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Apr 24 16:45:17 2013  Jiri (George) Lebl <jirka 5z com>
+
+       * src/parseutil.h, src/funclib.c: properly initialize
+         id.uninitialized (ironic huh? :)
+
+       * src/graphing.c: use the proper temp directory
+
 Wed Apr 24 15:54:44 2013  Jiri (George) Lebl <jirka 5z com>
 
        * help/Makefile.am: fix compile
diff --git a/src/funclib.c b/src/funclib.c
index 6bfc0f9..11971dd 100644
--- a/src/funclib.c
+++ b/src/funclib.c
@@ -862,6 +862,7 @@ gel_apply_func_to_matrixen (GelCtx *ctx,
                                GEL_GET_NEW_NODE(ni);
                                ni->type = GEL_IDENTIFIER_NODE;
                                ni->id.id = d_intern(ident);
+                               ni->id.uninitialized = FALSE;
 
                                GEL_GET_NEW_NODE(nn);
                                nn->type = GEL_OPERATOR_NODE;
@@ -933,6 +934,7 @@ gel_apply_func_to_matrix (GelCtx *ctx,
                                GEL_GET_NEW_NODE(ni);
                                ni->type = GEL_IDENTIFIER_NODE;
                                ni->id.id = d_intern(ident);
+                               ni->id.uninitialized = FALSE;
                                
                                nn->op.args = ni;
                                nn->op.args->any.next = gel_copynode(t[0]);
@@ -5115,6 +5117,7 @@ ptf_makenew_power(GelToken *id, int power)
        GEL_GET_NEW_NODE(tokn);
        tokn->type = GEL_IDENTIFIER_NODE;
        tokn->id.id = id;
+       tokn->id.uninitialized = FALSE;
 
        if(power == 1)
                return tokn;
diff --git a/src/graphing.c b/src/graphing.c
index 52ad182..c6ec9b3 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -766,7 +766,7 @@ plot_print_cb (void)
        GtkWidget *req = NULL;
        GtkWidget *hbox, *w, *cmd;
        int fd;
-       char tmpfile[] = "/tmp/genius-ps-XXXXXX";
+       char *tmpfile;
        static char *last_cmd = NULL;
 
        if (last_cmd == NULL)
@@ -816,8 +816,10 @@ plot_print_cb (void)
 
        gtk_widget_destroy (req);
 
+       tmpfile = g_build_filename (g_get_tmp_dir (), "genius-ps-XXXXXX", NULL);
        fd = g_mkstemp (tmpfile);
        if (fd < 0) {
+               g_free (tmpfile);
                genius_display_error (graph_window, _("Cannot open temporary file, cannot print."));
                return;
        }
@@ -849,6 +851,7 @@ plot_print_cb (void)
                gel_interrupted = FALSE;
                close (fd);
                unlink (tmpfile);
+               g_free (tmpfile);
                return;
        }
 
@@ -873,6 +876,7 @@ plot_print_cb (void)
 
        close (fd);
        unlink (tmpfile);
+       g_free (tmpfile);
 }
 
 static char *last_export_dir = NULL;
@@ -884,7 +888,7 @@ really_export_cb (GtkFileChooser *fs, int response, gpointer data)
        char *base;
        gboolean ret;
        gboolean eps;
-       char tmpfile[] = "/tmp/genius-ps-XXXXXX";
+       char *tmpfile = NULL;
        char *file_to_write = NULL;
        int fd = -1;
        gboolean run_epsi = FALSE;
@@ -939,6 +943,7 @@ really_export_cb (GtkFileChooser *fs, int response, gpointer data)
 
        file_to_write = s;
        if (eps && run_epsi && ve_is_prog_in_path ("ps2epsi")) {
+               tmpfile = g_build_filename (g_get_tmp_dir (), "genius-ps-XXXXXX", NULL);
                fd = g_mkstemp (tmpfile);
                /* FIXME: tell about errors ?*/
                if (fd >= 0) {
@@ -996,11 +1001,15 @@ really_export_cb (GtkFileChooser *fs, int response, gpointer data)
                if ( ! gel_interrupted)
                        genius_display_error (graph_window, _("Export failed"));
                g_free (s);
+               if (tmpfile != NULL)
+                       g_free (tmpfile);
                gel_interrupted = FALSE;
                return;
        }
 
        g_free (s);
+       if (tmpfile != NULL)
+               g_free (tmpfile);
 }
 
 static void
diff --git a/src/parseutil.h b/src/parseutil.h
index 232130e..dc61977 100644
--- a/src/parseutil.h
+++ b/src/parseutil.h
@@ -71,6 +71,7 @@ void gp_push_null(void) GEL_WEAK_FUNC;
        GEL_GET_NEW_NODE(tree); \
        tree->type = GEL_IDENTIFIER_NODE; \
        tree->id.id = d_intern(ID); \
+       tree->id.uninitialized = FALSE; \
        gel_stack_push(&gel_parsestack,tree); \
        g_free (ID); \
 }


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