[phodav: 5/18] wip: move some utils
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [phodav: 5/18] wip: move some utils
- Date: Thu, 10 Apr 2014 17:51:30 +0000 (UTC)
commit 38304d0276ed6d9a0232c28b038d5e09a797454c
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Thu Apr 10 16:57:57 2014 +0200
wip: move some utils
libphodav/phodav-server.c | 42 ------------------------------------------
libphodav/phodav-utils.c | 42 ++++++++++++++++++++++++++++++++++++++++++
libphodav/phodav-utils.h | 5 ++++-
3 files changed, 46 insertions(+), 43 deletions(-)
---
diff --git a/libphodav/phodav-server.c b/libphodav/phodav-server.c
index dfb7147..a8a91eb 100644
--- a/libphodav/phodav-server.c
+++ b/libphodav/phodav-server.c
@@ -530,48 +530,6 @@ node_add_time (xmlNodePtr node, guint64 time, SoupDateFormat format)
soup_date_free (date);
}
-static DepthType
-depth_from_string (const gchar *depth)
-{
- if (!depth)
- return DEPTH_INFINITY;
- else if (!g_strcmp0 (depth, "0"))
- return DEPTH_ZERO;
- else if (!g_strcmp0 (depth, "1"))
- return DEPTH_ONE;
- else if (!g_strcmp0 (depth, "infinity"))
- return DEPTH_INFINITY;
-
- g_warning ("Invalid depth: %s", depth);
- return DEPTH_INFINITY;
-}
-
-static guint
-timeout_from_string (const gchar *timeout)
-{
- if (!timeout ||
- !g_strcmp0 (timeout, "Infinite"))
- return 0;
-
- if (!g_ascii_strncasecmp (timeout, "Second-", 7))
- return g_ascii_strtoull (timeout + 7, NULL, 10);
-
- g_return_val_if_reached (0);
-}
-
-static const gchar *
-depth_to_string (DepthType depth)
-{
- if (depth == DEPTH_INFINITY)
- return "infinity";
- if (depth == DEPTH_ZERO)
- return "0";
- if (depth == DEPTH_ONE)
- return "1";
-
- g_return_val_if_reached (NULL);
-}
-
static gchar *
node_get_xattr_name (xmlNodePtr node, const gchar *prefix)
{
diff --git a/libphodav/phodav-utils.c b/libphodav/phodav-utils.c
index a91e3f3..4cd295d 100644
--- a/libphodav/phodav-utils.c
+++ b/libphodav/phodav-utils.c
@@ -109,3 +109,45 @@ davdoc_free (DavDoc *dd)
xmlFreeDoc (dd->doc);
g_free (dd->path);
}
+
+DepthType
+depth_from_string (const gchar *depth)
+{
+ if (!depth)
+ return DEPTH_INFINITY;
+ else if (!g_strcmp0 (depth, "0"))
+ return DEPTH_ZERO;
+ else if (!g_strcmp0 (depth, "1"))
+ return DEPTH_ONE;
+ else if (!g_strcmp0 (depth, "infinity"))
+ return DEPTH_INFINITY;
+
+ g_warning ("Invalid depth: %s", depth);
+ return DEPTH_INFINITY;
+}
+
+guint
+timeout_from_string (const gchar *timeout)
+{
+ if (!timeout ||
+ !g_strcmp0 (timeout, "Infinite"))
+ return 0;
+
+ if (!g_ascii_strncasecmp (timeout, "Second-", 7))
+ return g_ascii_strtoull (timeout + 7, NULL, 10);
+
+ g_return_val_if_reached (0);
+}
+
+const gchar *
+depth_to_string (DepthType depth)
+{
+ if (depth == DEPTH_INFINITY)
+ return "infinity";
+ if (depth == DEPTH_ZERO)
+ return "0";
+ if (depth == DEPTH_ONE)
+ return "1";
+
+ g_return_val_if_reached (NULL);
+}
diff --git a/libphodav/phodav-utils.h b/libphodav/phodav-utils.h
index d13d476..18780fc 100644
--- a/libphodav/phodav-utils.h
+++ b/libphodav/phodav-utils.h
@@ -23,8 +23,11 @@
G_BEGIN_DECLS
-void xml_node_to_string (xmlNodePtr root, xmlChar **mem, int *size);
+DepthType depth_from_string (const gchar *depth);
+const gchar * depth_to_string (DepthType depth);
+guint timeout_from_string (const gchar *timeout);
+void xml_node_to_string (xmlNodePtr root, xmlChar **mem, int *size);
typedef struct _DavDoc DavDoc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]