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

[PATCH 1/1] ref-filter: replace unportable `%lld` format

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 22, 2018, 12:01 UTC
Message-ID
<617f1e7b084ff95f4cc7c5a4b7b70b9a5c0d1af1.1542888057.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.87.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The `%lld` format is supported on Linux and macOS, but not on Windows. This issue has been reported ten days ago (Message-ID: nycvar.QRO.7.76.6.1811121300520.39@tvgsbejvaqbjf.bet), but the corresponding topic still advanced to `next` in the meantime, breaking the Windows build.

Let's use `PRIdMAX` and a cast to `intmax_t` instead, which unbreaks the build, and imitates how we do things e.g. in `json-writer.c` already.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 ref-filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ref-filter.c b/ref-filter.c
index 3cfe01a039..69cdf2dbb5 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -897,7 +897,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct expand_
 			v->s = xstrdup(type_name(oi->type));
 		else if (!strcmp(name, "objectsize:disk")) {
 			v->value = oi->disk_size;
-			v->s = xstrfmt("%lld", (long long)oi->disk_size);
+			v->s = xstrfmt("%"PRIdMAX, (intmax_t)oi->disk_size);
 		} else if (!strcmp(name, "objectsize")) {
 			v->value = oi->size;
 			v->s = xstrfmt("%lu", oi->size);
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 2 of 3 in “Fix Windows build of next”
  1. 0/1 Fix Windows build of nextJohannes Schindelin via GitGitGadget, Nov 22, 2018
  2. 1/1 ref-filter: replace unportable `%lld` formatJohannes Schindelin via GitGitGadget, Nov 22, 2018
  3. Junio C HamanoNov 24, 2018

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.