git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] mem-pool: drop trailing semicolon from macro definition

From
René Scharfe. <l.s.r@web.de>
Date
Mar 13, 2021, 16:17 UTC
Message-ID
<87289f1a-3f64-713b-6c29-210faf87bf98@web.de>

Allow BLOCK_GROWTH_SIZE to be used like an integer literal by removing the trailing semicolon from its definition. Also wrap the expression in parentheses, to allow it to be used with operators without leading to unexpected results. It doesn't matter for the current use site, but make it follow standard macro rules anyway to avoid future surprises.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 mem-pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mem-pool.c b/mem-pool.c
index 8401761dda..ccdcad2e3d 100644
--- a/mem-pool.c
+++ b/mem-pool.c
@@ -5,7 +5,7 @@
 #include "cache.h"
 #include "mem-pool.h"

-#define BLOCK_GROWTH_SIZE 1024*1024 - sizeof(struct mp_block);
+#define BLOCK_GROWTH_SIZE (1024 * 1024 - sizeof(struct mp_block))

 /*
  * Allocate a new mp_block and insert it after the block specified in
--
2.30.2
Message 1 of 1 in “mem-pool: drop trailing semicolon from macro definition”
  1. mem-pool: drop trailing semicolon from macro definitionRené Scharfe., Mar 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.