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

[PATCH 5/5] Use 'unsigned:1' when we mean boolean options

From
Shawn O. Pearce <spearce@spearce.org>
Date
Sep 18, 2007, 08:55 UTC
Message-ID
<20070918085500.GE5390@spearce.org>

These options are all strictly boolean (true/false). Its easier to document this implicitly by making their storage type a single bit. There is no compelling memory space reduction reason for this change, it just makes the structure definition slightly more readable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 fetch-pack.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fetch-pack.h b/fetch-pack.h
index cdcd84f..ad13076 100644
--- a/fetch-pack.h
+++ b/fetch-pack.h
@@ -4,14 +4,14 @@
 struct fetch_pack_args
 {
 	const char *uploadpack;
-	int quiet;
-	int keep_pack;
 	int unpacklimit;
-	int use_thin_pack;
-	int fetch_all;
-	int verbose;
 	int depth;
-	int no_progress;
+	unsigned quiet:1,
+		keep_pack:1,
+		use_thin_pack:1,
+		fetch_all:1,
+		verbose:1,
+		no_progress:1;
 };
 
 void setup_fetch_pack(struct fetch_pack_args *args);
-- 
1.5.3.1.1000.g7319b
Message 1 of 1 in “Use 'unsigned:1' when we mean boolean options”
  1. 5/5 Use 'unsigned:1' when we mean boolean optionsShawn O. Pearce, Sep 18, 2007

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.