1 From ce7b6454f3da80d19c7952fb125729f8ee61e7f6 Mon Sep 17 00:00:00 2001
2 From: Debarshi Ray <debarshir@gnome.org>
3 Date: Fri, 16 May 2014 14:15:04 +0200
4 Subject: 730243 Consolidate GErrorSafePtr definitions
6 * src/common/nmv-ustring.cc: Remove local copy of GErrorSafePtr.
7 (wstring_to_ustring): Use GErrorSafePtr from nmv-error.h
9 (ustring_to_wstring): Likewise.
10 * src/confmgr/nmv-gconf-mgr.cc: Remove local copy of
12 * src/common/nmv-safe-ptr-utils.h: Move the copy of
13 GErrorSafePtr definition here.
15 Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
17 diff --git a/src/common/nmv-safe-ptr-utils.h b/src/common/nmv-safe-ptr-utils.h
18 index 27b0f85..fdeb350 100644
19 --- a/src/common/nmv-safe-ptr-utils.h
20 +++ b/src/common/nmv-safe-ptr-utils.h
21 @@ -99,13 +99,29 @@ struct DelUnicharsUnref {
27 + operator () (GError *)
33 + operator () (GError *a_error)
36 + g_error_free (a_error);
41 typedef SafePtr <gchar, CharsRef, GCharUnref> GCharSafePtr;
42 typedef SafePtr <Object, ObjectRef, ObjectUnref> ObjectSafePtr;
43 typedef SafePtr <gchar, CharsRef, DelCharsUnref> CharSafePtr;
44 typedef SafePtr <gunichar, UnicharsRef, DelUnicharsUnref> UnicharSafePtr;
45 +typedef SafePtr<GError, GErrorRef, GErrorUnref> GErrorSafePtr;
47 NEMIVER_END_NAMESPACE(common)
48 NEMIVER_END_NAMESPACE(nemiver)
52 diff --git a/src/common/nmv-ustring.cc b/src/common/nmv-ustring.cc
53 index f5dfe49..41a1a26 100644
54 --- a/src/common/nmv-ustring.cc
55 +++ b/src/common/nmv-ustring.cc
56 @@ -479,21 +479,6 @@ WString::assign (super_type::size_type a_n, gunichar a_c)
61 - void operator () (GError *)
67 - void operator () (GError *a_err)
70 - g_error_free (a_err);
76 wstring_to_ustring (const WString &a_wstr,
78 @@ -504,7 +489,7 @@ wstring_to_ustring (const WString &a_wstr,
79 utf8_buf.reset (g_ucs4_to_utf8 (a_wstr.c_str (),
80 a_wstr.size (), &wstr_len,
81 &utf8_bytes_len, &err));
82 - SafePtr<GError, GErrorRef, GErrorUnref> error;
83 + GErrorSafePtr error;
86 LOG_ERROR ("got error conversion error: '" << error->message << "'");
87 @@ -531,7 +516,7 @@ ustring_to_wstring (const UString &a_ustr,
91 - SafePtr<GError, GErrorRef, GErrorUnref> error;
92 + GErrorSafePtr error;
95 LOG_ERROR ("got error conversion error: '" << error->message << "'");
96 diff --git a/src/confmgr/nmv-gconf-mgr.cc b/src/confmgr/nmv-gconf-mgr.cc
97 index fd7ff1c..672935b 100644
98 --- a/src/confmgr/nmv-gconf-mgr.cc
99 +++ b/src/confmgr/nmv-gconf-mgr.cc
100 @@ -92,16 +92,6 @@ public:
102 //static const char * NEMIVER_KEY_DIR = "/app/nemiver";
105 - void operator () (GError *a_error) {if (a_error) {}}
108 -struct GErrorUnref {
109 - void operator () (GError *a_error) {if (a_error) {g_error_free (a_error);}}
112 -typedef SafePtr<GError, GErrorRef, GErrorUnref> GErrorSafePtr;
115 client_notify_func (GConfClient *a_client,