]> git.pld-linux.org Git - packages/nemiver.git/blob - GErrorSafePtr.patch
- removed obsolete patches
[packages/nemiver.git] / GErrorSafePtr.patch
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
5
6         * src/common/nmv-ustring.cc: Remove local copy of GErrorSafePtr.
7         (wstring_to_ustring): Use GErrorSafePtr from nmv-error.h
8         instead of local copy.
9         (ustring_to_wstring): Likewise.
10         * src/confmgr/nmv-gconf-mgr.cc: Remove local copy of
11         GErrorSafePtr.
12         * src/common/nmv-safe-ptr-utils.h: Move the copy of
13         GErrorSafePtr definition here.
14
15 Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
16
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 {
22      }
23  };
24  
25 +struct GErrorRef {
26 +    void
27 +    operator () (GError *)
28 +    {}
29 +};
30 +
31 +struct GErrorUnref {
32 +    void
33 +    operator () (GError *a_error)
34 +    {
35 +        if (a_error) {
36 +            g_error_free (a_error);
37 +        }
38 +    }
39 +};
40 +
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;
46  
47  NEMIVER_END_NAMESPACE(common)
48  NEMIVER_END_NAMESPACE(nemiver)
49  
50  #endif
51 -
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)
57      return *this;
58  }
59  
60 -struct GErrorRef {
61 -    void operator () (GError *)
62 -    {
63 -    }
64 -};
65 -
66 -struct GErrorUnref {
67 -    void operator () (GError *a_err)
68 -    {
69 -        if (a_err) {
70 -            g_error_free (a_err);
71 -        }
72 -    }
73 -};
74 -
75  bool
76  wstring_to_ustring (const WString &a_wstr,
77                      UString &a_ustr)
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;
84      error.reset (err);
85      if (error) {
86          LOG_ERROR ("got error conversion error: '" << error->message << "'");
87 @@ -531,7 +516,7 @@ ustring_to_wstring (const UString &a_ustr,
88                                  &utf8_bytes_len,
89                                  &wstr_len,
90                                  &err));
91 -    SafePtr<GError, GErrorRef, GErrorUnref> error;
92 +    GErrorSafePtr error;
93      error.reset (err);
94      if (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:
101  
102  //static const char * NEMIVER_KEY_DIR = "/app/nemiver";
103  
104 -struct GErrorRef {
105 -    void operator () (GError *a_error) {if (a_error) {}}
106 -};
107 -
108 -struct GErrorUnref {
109 -    void operator () (GError *a_error) {if (a_error) {g_error_free (a_error);}}
110 -};
111 -
112 -typedef SafePtr<GError, GErrorRef, GErrorUnref> GErrorSafePtr;
113 -
114  void
115  client_notify_func (GConfClient *a_client,
116                      const char* a_key,
117 -- 
118 cgit v0.10.1
119
This page took 0.417649 seconds and 3 git commands to generate.