summaryrefslogtreecommitdiff
path: root/source/l/icu4c/icu4c.closenull.patch
blob: 3cc0b7f640aacadc9a020daffb70d5942c128eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--- icu/source/common/unicode/localpointer.h.orig       2016-02-21 21:40:54.346007093 +0100
+++ icu/source/common/unicode/localpointer.h    2016-02-21 21:46:25.455090792 +0100
@@ -508,12 +508,12 @@
                 : LocalPointerBase<Type>(src.ptr) { \
             src.ptr=NULL; \
         } \
-        ~LocalPointerClassName() { closeFunction(ptr); } \
+        ~LocalPointerClassName() { if (ptr != NULL) closeFunction(ptr); } \
         LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
             return moveFrom(src); \
         } \
         LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
-            closeFunction(ptr); \
+            if (ptr != NULL) closeFunction(ptr); \
             LocalPointerBase<Type>::ptr=src.ptr; \
             src.ptr=NULL; \
             return *this; \
@@ -527,7 +527,7 @@
             p1.swap(p2); \
         } \
         void adoptInstead(Type *p) { \
-            closeFunction(ptr); \
+            if (ptr != NULL) closeFunction(ptr); \
             ptr=p; \
         } \
     }
@@ -536,9 +536,9 @@
     class LocalPointerClassName : public LocalPointerBase<Type> { \
     public: \
         explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
-        ~LocalPointerClassName() { closeFunction(ptr); } \
+        ~LocalPointerClassName() { if (ptr != NULL) closeFunction(ptr); } \
         LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
-            closeFunction(ptr); \
+            if (ptr != NULL) closeFunction(ptr); \
             LocalPointerBase<Type>::ptr=src.ptr; \
             src.ptr=NULL; \
             return *this; \
@@ -552,7 +552,7 @@
             p1.swap(p2); \
         } \
         void adoptInstead(Type *p) { \
-            closeFunction(ptr); \
+            if (ptr != NULL) closeFunction(ptr); \
             ptr=p; \
         } \
     }