Date: Sat, 23 Jan 2016 20:49:52 +0000 (UTC) From: Eric van Gyzen <vangyzen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r294639 - stable/10/lib/libthr/thread Message-ID: <201601232049.u0NKnqRL051543@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vangyzen Date: Sat Jan 23 20:49:52 2016 New Revision: 294639 URL: https://svnweb.freebsd.org/changeset/base/294639 Log: 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. Modified: stable/10/lib/libthr/thread/thr_umtx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_umtx.c ============================================================================== --- stable/10/lib/libthr/thread/thr_umtx.c Sat Jan 23 20:01:46 2016 (r294638) +++ stable/10/lib/libthr/thread/thr_umtx.c Sat Jan 23 20:49:52 2016 (r294639) @@ -42,7 +42,7 @@ int _umtx_op_err(void *obj, int op, u_lo 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601232049.u0NKnqRL051543>