Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Core: enclosed parameters of macros in parentheses.

July 24, 2020 03:58PM
On Sat, Jul 18, 2020 at 08:09:30PM +0800, balus wrote:
> # HG changeset patch
> # User balus <balus@foxmail.com&gt;
> # Date 1595073121 -28800
> #&nbsp; &nbsp; &nbsp; Sat Jul 18 19:52:01 2020 +0800
> # Node ID 92d9878c0c7549345f0a144cd81a6b6d45f21fc6
> # Parent&nbsp; 32a343635b50662979975e1204417bb1fc7e1b1f
> Core: enclosed parameters of macros in parentheses.

I'm going to commit the following updated patch:

# HG changeset patch
# User balus <balus@foxmail.com>
# Date 1595399139 -10800
# Wed Jul 22 09:25:39 2020 +0300
# Node ID 827f61a45a12382773c4053e7858594c2ce611c0
# Parent 4f30f75dbdf33d6fae9e70086e0df5cbab7db027
Core: enclosed parameters of the ngx_buf.h macros in parentheses.

diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h
--- a/src/core/ngx_buf.h
+++ b/src/core/ngx_buf.h
@@ -125,20 +125,20 @@ typedef struct {
#define NGX_CHAIN_ERROR (ngx_chain_t *) NGX_ERROR


-#define ngx_buf_in_memory(b) (b->temporary || b->memory || b->mmap)
-#define ngx_buf_in_memory_only(b) (ngx_buf_in_memory(b) && !b->in_file)
+#define ngx_buf_in_memory(b) ((b)->temporary || (b)->memory || (b)->mmap)
+#define ngx_buf_in_memory_only(b) (ngx_buf_in_memory(b) && !(b)->in_file)

#define ngx_buf_special(b) \
- ((b->flush || b->last_buf || b->sync) \
- && !ngx_buf_in_memory(b) && !b->in_file)
+ (((b)->flush || (b)->last_buf || (b)->sync) \
+ && !ngx_buf_in_memory(b) && !(b)->in_file)

#define ngx_buf_sync_only(b) \
- (b->sync \
- && !ngx_buf_in_memory(b) && !b->in_file && !b->flush && !b->last_buf)
+ ((b)->sync && !ngx_buf_in_memory(b) \
+ && !(b)->in_file && !(b)->flush && !(b)->last_buf)

#define ngx_buf_size(b) \
- (ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos): \
- (b->file_last - b->file_pos))
+ (ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos): \
+ ((b)->file_last - (b)->file_pos))

ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size);
ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs);
@@ -149,8 +149,8 @@ ngx_chain_t *ngx_create_chain_of_bufs(ng

ngx_chain_t *ngx_alloc_chain_link(ngx_pool_t *pool);
#define ngx_free_chain(pool, cl) \
- cl->next = pool->chain; \
- pool->chain = cl
+ (cl)->next = (pool)->chain; \
+ (pool)->chain = (cl)



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Core: enclosed parameters of macros in parentheses.

balus 166 July 18, 2020 08:10AM

Re: [PATCH] Core: enclosed parameters of macros in parentheses.

ru@nginx.com 34 July 24, 2020 03:58PM

Re: [PATCH] Core: enclosed parameters of macros in parentheses.

balus 47 July 24, 2020 07:52PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready