Title: [206377] trunk/Source
Revision
206377
Author
mcatanz...@igalia.com
Date
2016-09-26 09:40:38 -0700 (Mon, 26 Sep 2016)

Log Message

std::unique_ptr deleter functions should not check if pointer is null
https://bugs.webkit.org/show_bug.cgi?id=162558

Reviewed by Alex Christensen.

std::unique_ptr already does this before calling the deleter.

Source/WebCore:

* platform/graphics/x11/XUniquePtr.h:
(WebCore::XPtrDeleter::operator()):
(WebCore::XPtrDeleter<XImage>::operator()):
(WebCore::XPtrDeleter<_XGC>::operator()):
(WebCore::XPtrDeleter<__GLXcontextRec>::operator()):

Source/WTF:

* wtf/efl/UniquePtrEfl.h:
* wtf/glib/GUniquePtr.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (206376 => 206377)


--- trunk/Source/WTF/ChangeLog	2016-09-26 15:25:01 UTC (rev 206376)
+++ trunk/Source/WTF/ChangeLog	2016-09-26 16:40:38 UTC (rev 206377)
@@ -1 +1,13 @@
+2016-09-26  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        std::unique_ptr deleter functions should not check if pointer is null
+        https://bugs.webkit.org/show_bug.cgi?id=162558
+
+        Reviewed by Alex Christensen.
+
+        std::unique_ptr already does this before calling the deleter.
+
+        * wtf/efl/UniquePtrEfl.h:
+        * wtf/glib/GUniquePtr.h:
+
 == Rolled over to ChangeLog-2016-09-26 ==

Modified: trunk/Source/WTF/wtf/efl/UniquePtrEfl.h (206376 => 206377)


--- trunk/Source/WTF/wtf/efl/UniquePtrEfl.h	2016-09-26 15:25:01 UTC (rev 206376)
+++ trunk/Source/WTF/wtf/efl/UniquePtrEfl.h	2016-09-26 16:40:38 UTC (rev 206377)
@@ -54,8 +54,7 @@
     { \
         void operator() (typeName* ptr) const \
         { \
-            if (ptr) \
-                deleterFunc(ptr); \
+            deleterFunc(ptr); \
         } \
     };
 

Modified: trunk/Source/WTF/wtf/glib/GUniquePtr.h (206376 => 206377)


--- trunk/Source/WTF/wtf/glib/GUniquePtr.h	2016-09-26 15:25:01 UTC (rev 206376)
+++ trunk/Source/WTF/wtf/glib/GUniquePtr.h	2016-09-26 16:40:38 UTC (rev 206377)
@@ -52,8 +52,7 @@
     { \
         void operator() (typeName* ptr) const \
         { \
-            if (ptr) \
-                deleterFunc(ptr); \
+            deleterFunc(ptr); \
         } \
     };
 

Modified: trunk/Source/WebCore/ChangeLog (206376 => 206377)


--- trunk/Source/WebCore/ChangeLog	2016-09-26 15:25:01 UTC (rev 206376)
+++ trunk/Source/WebCore/ChangeLog	2016-09-26 16:40:38 UTC (rev 206377)
@@ -1,3 +1,18 @@
+2016-09-26  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        std::unique_ptr deleter functions should not check if pointer is null
+        https://bugs.webkit.org/show_bug.cgi?id=162558
+
+        Reviewed by Alex Christensen.
+
+        std::unique_ptr already does this before calling the deleter.
+
+        * platform/graphics/x11/XUniquePtr.h:
+        (WebCore::XPtrDeleter::operator()):
+        (WebCore::XPtrDeleter<XImage>::operator()):
+        (WebCore::XPtrDeleter<_XGC>::operator()):
+        (WebCore::XPtrDeleter<__GLXcontextRec>::operator()):
+
 2016-09-26  Per Arne Vollan  <pvol...@apple.com>
 
         [Win][Debug] Compile fix.

Modified: trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h (206376 => 206377)


--- trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h	2016-09-26 15:25:01 UTC (rev 206376)
+++ trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h	2016-09-26 16:40:38 UTC (rev 206377)
@@ -41,8 +41,7 @@
 struct XPtrDeleter {
     void operator()(T* ptr) const
     {
-        if (ptr)
-            XFree(ptr);
+        XFree(ptr);
     }
 };
 
@@ -52,8 +51,7 @@
 template<> struct XPtrDeleter<XImage> {
     void operator() (XImage* ptr) const
     {
-        if (ptr)
-            XDestroyImage(ptr);
+        XDestroyImage(ptr);
     }
 };
 
@@ -60,8 +58,7 @@
 template<> struct XPtrDeleter<_XGC> {
     void operator() (_XGC* ptr) const
     {
-        if (ptr)
-            XFreeGC(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
+        XFreeGC(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
     }
 };
 // Give a name to this to avoid having to use the internal struct name.
@@ -71,8 +68,7 @@
 template<> struct XPtrDeleter<__GLXcontextRec> {
     void operator() (__GLXcontextRec* ptr)
     {
-        if (ptr)
-            glXDestroyContext(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
+        glXDestroyContext(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
     }
 };
 // Give a name to this to avoid having to use the internal struct name.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to