[evolution-data-server] Deprecate e_uid_new() in favor of e_util_generate_uid()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Deprecate e_uid_new() in favor of e_util_generate_uid()
- Date: Fri, 26 May 2017 06:58:31 +0000 (UTC)
commit 95680d4e6d795283250dd474e1da8eea0cf67a4b
Author: Milan Crha <mcrha redhat com>
Date: Fri May 26 08:55:38 2017 +0200
Deprecate e_uid_new() in favor of e_util_generate_uid()
No soname version bump, thus no real code deprecation, just made
a note in the developer comment about deprecation and replaced
the function body.
src/libebackend/e-collection-backend.c | 2 +-
src/libebackend/e-server-side-source.c | 6 +++---
src/libedataserver/e-source.c | 2 +-
src/libedataserver/e-uid.c | 18 ++++--------------
4 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/src/libebackend/e-collection-backend.c b/src/libebackend/e-collection-backend.c
index 67c19de..196634f 100644
--- a/src/libebackend/e-collection-backend.c
+++ b/src/libebackend/e-collection-backend.c
@@ -153,7 +153,7 @@ collection_backend_new_user_file (ECollectionBackend *backend)
/* This is like e_server_side_source_new_user_file()
* except that it uses the backend's cache directory. */
- safe_uid = e_uid_new ();
+ safe_uid = e_util_generate_uid ();
e_filename_make_safe (safe_uid);
cache_dir = e_collection_backend_get_cache_dir (backend);
diff --git a/src/libebackend/e-server-side-source.c b/src/libebackend/e-server-side-source.c
index 7afa5a7..e357742 100644
--- a/src/libebackend/e-server-side-source.c
+++ b/src/libebackend/e-server-side-source.c
@@ -1554,7 +1554,7 @@ server_side_source_initable_init (GInitable *initable,
uid = e_source_dup_uid (E_SOURCE (source));
if (uid == NULL)
- uid = e_uid_new ();
+ uid = e_util_generate_uid ();
e_dbus_source_set_uid (dbus_source, uid);
g_free (uid);
@@ -1782,7 +1782,7 @@ e_server_side_source_get_user_dir (void)
*
* Generates a unique file name for a new user-specific data source.
* If @uid is non-%NULL it will be used in the basename of the file,
- * otherwise a unique basename will be generated using e_uid_new().
+ * otherwise a unique basename will be generated using e_util_generate_uid().
*
* The returned #GFile can then be passed to e_server_side_source_new().
* Unreference the #GFile with g_object_unref() when finished with it.
@@ -1803,7 +1803,7 @@ e_server_side_source_new_user_file (const gchar *uid)
const gchar *user_dir;
if (uid == NULL)
- safe_uid = e_uid_new ();
+ safe_uid = e_util_generate_uid ();
else
safe_uid = g_strdup (uid);
e_filename_make_safe (safe_uid);
diff --git a/src/libedataserver/e-source.c b/src/libedataserver/e-source.c
index 51b2bfc..e2b5806 100644
--- a/src/libedataserver/e-source.c
+++ b/src/libedataserver/e-source.c
@@ -2031,7 +2031,7 @@ source_initable_init (GInitable *initable,
* so generate a new unique identifier (UID) unless one was
* explicitly provided through e_source_new_with_uid(). */
} else if (source->priv->uid == NULL) {
- source->priv->uid = e_uid_new ();
+ source->priv->uid = e_util_generate_uid ();
}
/* Try to avoid a spurious "changed" emission. */
diff --git a/src/libedataserver/e-uid.c b/src/libedataserver/e-uid.c
index 7863149..52c266a 100644
--- a/src/libedataserver/e-uid.c
+++ b/src/libedataserver/e-uid.c
@@ -20,9 +20,7 @@
#include "e-uid.h"
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
+#include "e-data-server-util.h"
/**
* e_uid_new:
@@ -31,19 +29,11 @@
*
* Returns: The newly generated UID. The caller should free the string
* when it's done with it.
+ *
+ * Deprecated: 3.26: Use e_util_generate_uid() instead.
**/
gchar *
e_uid_new (void)
{
- static gint serial = 0;
- static gchar *hostname = NULL;
-
- if (hostname == NULL)
- hostname = (gchar *) g_get_host_name ();
-
- return g_strdup_printf (
- "%lu.%lu.%d@%s",
- (gulong) time (NULL),
- (gulong) getpid (),
- serial++, hostname);
+ return e_util_generate_uid ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]