diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-10 19:33:58 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-10 19:33:58 +0000 |
commit | 6e91d78151e10ed31c475cafe6a1e1f11950c1d9 (patch) | |
tree | 6796a0cd32cea8fd5591b7f2c6d10ae7f153ccb9 /lib/libc/locale | |
parent | 1485828b0840fbefcb7789ae54df9650c16fda61 (diff) | |
download | FreeBSD-src-6e91d78151e10ed31c475cafe6a1e1f11950c1d9.zip FreeBSD-src-6e91d78151e10ed31c475cafe6a1e1f11950c1d9.tar.gz |
libc: replace 0 with NULL for pointers.
While here also cleanup some surrounding code; particularly
drop some malloc() casts.
Found with devel/coccinelle.
Reviewed by: bde (previous version - all new bugs are mine)
Diffstat (limited to 'lib/libc/locale')
-rw-r--r-- | lib/libc/locale/xlocale_private.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h index 502b548..77b9ff4 100644 --- a/lib/libc/locale/xlocale_private.h +++ b/lib/libc/locale/xlocale_private.h @@ -155,12 +155,11 @@ __attribute__((unused)) static void xlocale_release(void *val) { struct xlocale_refcounted *obj = val; - long count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1; - if (count < 0) { - if (0 != obj->destructor) { - obj->destructor(obj); - } - } + long count; + + count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1; + if (count < 0 && obj->destructor != NULL) + obj->destructor(obj); } /** |