diff options
author | Tor Lillqvist <tml@novell.com> | 2005-12-18 00:50:36 +0800 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2005-12-18 00:50:36 +0800 |
commit | d0742036000286cd5ec17e1624f0242530e761db (patch) | |
tree | 8727eac9aa2f9c9f800de61de4bd2aa3e2d7a7e1 | |
parent | 0c08672df97b474a3cf299fccca47f933f12e84d (diff) | |
download | gsoc2013-evolution-d0742036000286cd5ec17e1624f0242530e761db.tar.gz gsoc2013-evolution-d0742036000286cd5ec17e1624f0242530e761db.tar.zst gsoc2013-evolution-d0742036000286cd5ec17e1624f0242530e761db.zip |
Remove these functions that are now in libedataserver/e-xml-utils.c
2005-12-17 Tor Lillqvist <tml@novell.com>
* e-xml-utils.c (e_xml_get_child_by_name, e_xml_save_file): Remove
these functions that are now in libedataserver/e-xml-utils.c
* e-xml-utils.h: Include libedataserver/e-xml-utils.h.
svn path=/trunk/; revision=30826
-rw-r--r-- | e-util/ChangeLog | 5 | ||||
-rw-r--r-- | e-util/e-xml-utils.c | 92 | ||||
-rw-r--r-- | e-util/e-xml-utils.h | 5 |
3 files changed, 8 insertions, 94 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index c8250bfab4..158ce2e383 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -28,6 +28,11 @@ the uses of fsync() in evo are pretty irrelevant. Just #define fsync() away on Win32. + * e-xml-utils.c (e_xml_get_child_by_name, e_xml_save_file): Remove + these functions that are now in libedataserver/e-xml-utils.c + + * e-xml-utils.h: Include libedataserver/e-xml-utils.h. + 2005-12-12 Irene Huang <Irene.Huang@sun.com> reviewed by: Veerapuram Varadhan <vvaradhan@novell.com> diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c index 5ac741a278..f761225d8b 100644 --- a/e-util/e-xml-utils.c +++ b/e-util/e-xml-utils.c @@ -44,22 +44,6 @@ #include "e-util.h" #include "e-xml-utils.h" -xmlNode * -e_xml_get_child_by_name (const xmlNode *parent, const xmlChar *child_name) -{ - xmlNode *child; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (child_name != NULL, NULL); - - for (child = parent->xmlChildrenNode; child != NULL; child = child->next) { - if (xmlStrcmp (child->name, child_name) == 0) { - return child; - } - } - return NULL; -} - /* Returns the first child with the name child_name and the "lang" * attribute that matches the current LC_MESSAGES, or else, the first * child with the name child_name and no "lang" attribute. @@ -448,79 +432,3 @@ e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar * return ret_val; } - -int -e_xml_save_file (const char *filename, xmlDocPtr doc) -{ - char *filesave, *xmlbuf; - size_t n, written = 0; - int ret, fd, size; - int errnosave; - ssize_t w; - - { - gchar *dirname = g_path_get_dirname (filename); - gchar *basename = g_path_get_basename (filename); - gchar *savebasename = g_strconcat (".#", basename, NULL); - - g_free (basename); - filesave = g_build_filename (dirname, savebasename, NULL); - g_free (savebasename); - g_free (dirname); - } - - fd = g_open (filesave, O_WRONLY | O_CREAT | O_TRUNC, 0600); - if (fd == -1) { - g_free (filesave); - return -1; - } - - xmlDocDumpFormatMemory (doc, (xmlChar **) &xmlbuf, &size, TRUE); - if (size <= 0) { - close (fd); - g_unlink (filesave); - g_free (filesave); - errno = ENOMEM; - return -1; - } - - n = (size_t) size; - do { - do { - w = write (fd, xmlbuf + written, n - written); - } while (w == -1 && errno == EINTR); - - if (w > 0) - written += w; - } while (w != -1 && written < n); - - xmlFree (xmlbuf); - - if (written < n || fsync (fd) == -1) { - errnosave = errno; - close (fd); - g_unlink (filesave); - g_free (filesave); - errno = errnosave; - return -1; - } - - while ((ret = close (fd)) == -1 && errno == EINTR) - ; - - if (ret == -1) { - g_free (filesave); - return -1; - } - - if (g_rename (filesave, filename) == -1) { - errnosave = errno; - g_unlink (filesave); - g_free (filesave); - errno = errnosave; - return -1; - } - g_free (filesave); - - return 0; -} diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h index 6c39ee6f79..501a643fea 100644 --- a/e-util/e-xml-utils.h +++ b/e-util/e-xml-utils.h @@ -25,12 +25,13 @@ #define __E_XML_UTILS__ #include <glib.h> + #include <libxml/tree.h> +#include <libedataserver/e-xml-utils.h> + G_BEGIN_DECLS -xmlNode *e_xml_get_child_by_name (const xmlNode *parent, - const xmlChar *child_name); /* lang set to NULL means use the current locale. */ xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent, const xmlChar *child_name, |