diff options
author | vangyzen <vangyzen@FreeBSD.org> | 2016-01-23 20:49:52 +0000 |
---|---|---|
committer | vangyzen <vangyzen@FreeBSD.org> | 2016-01-23 20:49:52 +0000 |
commit | dab5810197d121819a52c51d5d2db44e161b674d (patch) | |
tree | bbfc2892b402ec2b4fb2151c6e614b2806297503 /lib | |
parent | 49868192d4f0bdcbea10825f9e529c99c278bd58 (diff) | |
download | FreeBSD-src-dab5810197d121819a52c51d5d2db44e161b674d.zip FreeBSD-src-dab5810197d121819a52c51d5d2db44e161b674d.tar.gz |
MFC r293858
libthr: const-ify two variables
Make the default umutex and urwlock initializers const,
because they can be, and as a microoptimization.
Sponsored by: Dell Inc.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index a61dab0..37e5df1 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -42,7 +42,7 @@ int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2) void _thr_umutex_init(struct umutex *mtx) { - static struct umutex default_mtx = DEFAULT_UMUTEX; + static const struct umutex default_mtx = DEFAULT_UMUTEX; *mtx = default_mtx; } @@ -50,7 +50,8 @@ _thr_umutex_init(struct umutex *mtx) void _thr_urwlock_init(struct urwlock *rwl) { - static struct urwlock default_rwl = DEFAULT_URWLOCK; + static const struct urwlock default_rwl = DEFAULT_URWLOCK; + *rwl = default_rwl; } |