Commit a2906fe 1 parent 2881434 commit a2906fe Copy full SHA for a2906fe
File tree 2 files changed +17
-6
lines changed
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -239,12 +239,7 @@ void
239
239
qvi_hwpool_free (
240
240
qvi_hwpool_t **rpool
241
241
) {
242
- if (!rpool) return ;
243
- qvi_hwpool_t *irpool = *rpool;
244
- if (!irpool) goto out;
245
- delete irpool;
246
- out:
247
- *rpool = nullptr ;
242
+ qvi_delete (rpool);
248
243
}
249
244
250
245
int
Original file line number Diff line number Diff line change 21
21
22
22
#ifdef __cplusplus
23
23
24
+ /* *
25
+ * Simple wrapper around delete that also nullifies the input pointer.
26
+ */
27
+ template <class T >
28
+ void
29
+ qvi_delete (
30
+ T **t
31
+ ) {
32
+ if (!t) return ;
33
+ T *it = *t;
34
+ if (!it) goto out;
35
+ delete it;
36
+ out:
37
+ *t = nullptr ;
38
+ }
39
+
24
40
/* *
25
41
* Returns the code captured by a constructor. Since we are trying to avoid the
26
42
* use of exceptions, we instead use this method for checking the state of an
You can’t perform that action at this time.
0 commit comments