[gnumeric] Compilation: simplify using not-quite-new glib additions.



commit f19774ba6a301252a59f6475b63916accda7f450
Author: Morten Welinder <terra gnome org>
Date:   Wed Jan 8 12:58:20 2014 -0500

    Compilation: simplify using not-quite-new glib additions.

 ChangeLog             |    3 +++
 configure.ac          |    2 +-
 src/wbc-gtk-actions.c |   38 ++------------------------------------
 3 files changed, 6 insertions(+), 37 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3b60ec3..d9d8642 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-01-08  Morten Welinder  <terra gnome org>
 
+       * src/wbc-gtk-actions.c (cb_file_sendto): Simplify using
+       g_mkdtemp_full.
+
        * src/mathfunc.c (dpois_raw): Detect underflow in direct formula.
 
        * src/gui-file.h: Namespace improvements.  Also make gui_file_read
diff --git a/configure.ac b/configure.ac
index 46c7d8b..3984458 100644
--- a/configure.ac
+++ b/configure.ac
@@ -563,7 +563,7 @@ unset SAVE_LIBS
 AC_HEADER_SYS_WAIT
 
 dnl Check for some functions
-AC_CHECK_FUNCS(memmove mkdtemp uname times sysconf)
+AC_CHECK_FUNCS(uname)
 
 dnl FIXME: Does this really belong here?
 AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)])
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index f414cd9..cf895f8 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -107,14 +107,6 @@ static GNM_ACTION_DEF (cb_file_save_as)    { gui_file_save_as
                (wbcg, wb_control_view (WORKBOOK_CONTROL (wbcg)),
                 GNM_FILE_SAVE_AS_STYLE_SAVE, NULL); }
 
-#ifndef HAVE_MKDTEMP
-#include "gnm-random.h"
-#ifdef G_OS_WIN32
-#include <process.h>
-#include <errno.h>
-#endif
-#endif
-
 static GNM_ACTION_DEF (cb_file_sendto) {
        WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
        WorkbookView *wbv = wb_control_view (wbc);
@@ -135,35 +127,9 @@ static GNM_ACTION_DEF (cb_file_sendto) {
                char *template, *full_name, *uri;
                char *basename = g_path_get_basename (go_doc_get_uri (GO_DOC (wb)));
 
-#define GNM_SEND_DIR   ".gnm-sendto-"
-#ifdef HAVE_MKDTEMP
                template = g_build_filename (g_get_tmp_dir (),
-                       GNM_SEND_DIR "XXXXXX", NULL);
-               problem = (mkdtemp (template) == NULL);
-#else
-               while (1) {
-                       char *dirname = g_strdup_printf
-                               ("%s%ld-%08d",
-                                GNM_SEND_DIR,
-                                (long)getpid (),
-                                (int)(1e8 * random_01 ()));
-                       template = g_build_filename (g_get_tmp_dir (), dirname, NULL);
-                       g_free (dirname);
-
-                       if (g_mkdir (template, 0700) == 0) {
-                               problem = FALSE;
-                               break;
-                       }
-
-                       if (errno != EEXIST) {
-                               go_cmd_context_error_export (gcc,
-                                       _("Failed to create temporary file for sending."));
-                               go_io_error_display (io_context);
-                               problem = TRUE;
-                               break;
-                       }
-               }
-#endif
+                                            ".gnm-sendto-XXXXXX", NULL);
+               problem = (g_mkdtemp_full (template, 0600) == NULL);
 
                if (problem) {
                        g_free (template);


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