diff options
-rw-r--r-- | widgets/table/e-table-specification.c | 22 | ||||
-rw-r--r-- | widgets/table/e-table-state.c | 19 | ||||
-rw-r--r-- | widgets/table/e-table.c | 18 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 21 |
4 files changed, 6 insertions, 74 deletions
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 92f8b42921..7395ce60aa 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -27,11 +27,8 @@ #include "e-table-specification.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <errno.h> #include <gtk/gtksignal.h> #include <gnome-xml/parser.h> @@ -284,7 +281,6 @@ int e_table_specification_save_to_file (ETableSpecification *specification, const char *filename) { - char *tmp, *slash; xmlDoc *doc; int ret; @@ -292,26 +288,12 @@ e_table_specification_save_to_file (ETableSpecification *specification, g_return_val_if_fail (filename != NULL, -1); g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), -1); - if ((doc = xmlNewDoc ("1.0")) == NULL) { - errno = ENOMEM; + if ((doc = xmlNewDoc ("1.0")) == NULL) return -1; - } xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); - tmp = alloca (strlen (filename) + 5); - slash = strrchr (filename, '/'); - if (slash) - sprintf (tmp, "%.*s.#%s", slash - filename + 1, filename, slash + 1); - else - sprintf (tmp, ".#%s", filename); - - ret = e_xml_save_file (tmp, doc); - if (ret != -1) - ret = rename (tmp, filename); - - if (ret == -1) - unlink (tmp); + ret = e_xml_save_file (filename, doc); xmlFreeDoc (doc); diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index 59a05f6738..c9117add68 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -26,11 +26,8 @@ #include <config.h> #endif -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <errno.h> #include <gtk/gtksignal.h> #include <gtk/gtkobject.h> @@ -187,28 +184,14 @@ void e_table_state_save_to_file (ETableState *state, const char *filename) { - char *tmp, *slash; xmlDoc *doc; - int ret; if ((doc = xmlNewDoc ("1.0")) == NULL) return; xmlDocSetRootElement (doc, e_table_state_save_to_node (state, NULL)); - tmp = alloca (strlen (filename) + 5); - slash = strrchr (filename, '/'); - if (slash) - sprintf (tmp, "%.*s.#%s", slash - filename + 1, filename, slash + 1); - else - sprintf (tmp, ".#%s", filename); - - ret = e_xml_save_file (tmp, doc); - if (ret != -1) - ret = rename (tmp, filename); - - if (ret == -1) - unlink (tmp); + e_xml_save_file (filename, doc); xmlFreeDoc (doc); } diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 2fba247dab..5af05304ba 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -27,10 +27,8 @@ #include <config.h> #endif -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> @@ -1793,26 +1791,12 @@ void e_table_save_specification (ETable *e_table, const char *filename) { xmlDoc *doc = et_build_tree (e_table); - char *tmp, *slash; - int ret; g_return_if_fail(e_table != NULL); g_return_if_fail(E_IS_TABLE(e_table)); g_return_if_fail(filename != NULL); - tmp = alloca (strlen (filename) + 5); - slash = strrchr (filename, '/'); - if (slash) - sprintf (tmp, "%.*s.#%s", slash - filename + 1, filename, slash + 1); - else - sprintf (tmp, ".#%s", filename); - - ret = e_xml_save_file (tmp, doc); - if (ret != -1) - ret = rename (tmp, filename); - - if (ret == -1) - unlink (tmp); + e_xml_save_file (filename, doc); xmlFreeDoc (doc); } diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 552b15ddf6..92c33668de 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -27,11 +27,8 @@ #include <config.h> #endif -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <errno.h> #include <gtk/gtksignal.h> #include <gnome-xml/tree.h> @@ -940,17 +937,15 @@ void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename) { ETreeTableAdapterPriv *priv; - char *tmp, *slash; TreeAndRoot tar; xmlDocPtr doc; xmlNode *root; - int ret; g_return_if_fail(etta != NULL); priv = etta->priv; - doc = xmlNewDoc ((xmlChar*) "1.0"); + doc = xmlNewDoc ("1.0"); root = xmlNewDocNode (doc, NULL, (xmlChar *) "expanded_state", NULL); @@ -966,19 +961,7 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f save_expanded_state_func, &tar); - tmp = alloca (strlen (filename) + 5); - slash = strrchr (filename, '/'); - if (slash) - sprintf (tmp, "%.*s.#%s", slash - filename + 1, filename, slash + 1); - else - sprintf (tmp, ".#%s", filename); - - ret = e_xml_save_file (tmp, doc); - if (ret != -1) - ret = rename (tmp, filename); - - if (ret == -1) - unlink (tmp); + e_xml_save_file (filename, doc); xmlFreeDoc (doc); } |