ekiga r7365 - trunk/lib/gmref
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7365 - trunk/lib/gmref
- Date: Sun, 16 Nov 2008 09:53:26 +0000 (UTC)
Author: jpuydt
Date: Sun Nov 16 09:53:25 2008
New Revision: 7365
URL: http://svn.gnome.org/viewvc/ekiga?rev=7365&view=rev
Log:
Simplified gmref_ptr
Modified:
trunk/lib/gmref/gmref.h
Modified: trunk/lib/gmref/gmref.h
==============================================================================
--- trunk/lib/gmref/gmref.h (original)
+++ trunk/lib/gmref/gmref.h Sun Nov 16 09:53:25 2008
@@ -99,7 +99,6 @@
template<typename Tprim> friend void gmref_dec (gmref_ptr<Tprim> ptr);
void reset ();
- void inc ();
T* obj;
};
@@ -122,25 +121,22 @@
/* implementation of the templates */
template<typename T>
-gmref_ptr<T>::gmref_ptr (T* obj_ = 0)
+gmref_ptr<T>::gmref_ptr (T* obj_ = 0): obj(obj_)
{
- obj = obj_;
- inc ();
+ gmref_inc (obj);
}
template<typename T>
-gmref_ptr<T>::gmref_ptr (const gmref_ptr<T>& ptr)
+gmref_ptr<T>::gmref_ptr (const gmref_ptr<T>& ptr): obj(ptr.obj)
{
- obj = ptr.obj;
- inc ();
+ gmref_inc (obj);
}
template<typename T>
template<typename Tprim>
-gmref_ptr<T>::gmref_ptr (const gmref_ptr<Tprim>& ptr)
+gmref_ptr<T>::gmref_ptr (const gmref_ptr<Tprim>& ptr): obj(dynamic_cast<T*>(ptr.obj))
{
- obj = dynamic_cast<T*>(ptr.obj);
- inc ();
+ gmref_inc (obj);
}
template<typename T>
@@ -157,7 +153,7 @@
reset ();
obj = other.obj;
- inc ();
+ gmref_inc (obj);
}
return *this;
@@ -208,17 +204,8 @@
void
gmref_ptr<T>::reset ()
{
- if (obj != 0)
- gmref_dec (obj);
+ gmref_dec (obj);
obj = 0;
}
-template<typename T>
-void
-gmref_ptr<T>::inc ()
-{
- if (obj != 0)
- gmref_inc (obj);
-}
-
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]