# HG changeset patch # User Igor Sysoev # Date 1168531623 0 # Node ID 51d0884364fe0b8d75690157acc145702b4c065b # Parent f1ebccfd95f98e739f2eb9cf858a6207eab3d49b optimize inlined code for gcc diff --git a/src/core/ngx_shmtx.h b/src/core/ngx_shmtx.h --- a/src/core/ngx_shmtx.h +++ b/src/core/ngx_shmtx.h @@ -30,11 +30,7 @@ ngx_int_t ngx_shmtx_create(ngx_shmtx_t * static ngx_inline ngx_uint_t ngx_shmtx_trylock(ngx_shmtx_t *mtx) { - if (*mtx->lock == 0 && ngx_atomic_cmp_set(mtx->lock, 0, ngx_pid)) { - return 1; - } - - return 0; + return (*mtx->lock == 0 && ngx_atomic_cmp_set(mtx->lock, 0, ngx_pid)); } #define ngx_shmtx_lock(mtx) ngx_spinlock((mtx)->lock, ngx_pid, 1024)