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

[PATCH] (tig) Fix signed char comparison where char is unsigned by default.

From
RSRussell Steicke <russellsteicke@gmail.com>
Date
Mar 18, 2008, 08:47 UTC
Message-ID
<20080318084743.GA16827@maggie.localnet>

tig uses a char as a flag, and expects that to have three values: TRUE, FALSE, and -1. When char is unsigned char (such as on PPC), this fails with the compiler warning "comparison is always false due to limited range of data type".

So explicitly make the flag a signed char.

Detecting the int8_t type with the autoconf macro AC_CREATE_STDINT_H would probably be a better fix.

Signed-off-by: Russell Steicke <russellsteicke@gmail.com>
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tig.c b/tig.c
index 89a4c5d..448ce20 100644
--- a/tig.c
+++ b/tig.c
@@ -434,7 +434,7 @@ static iconv_t opt_iconv		= ICONV_NONE;
 static char opt_search[SIZEOF_STR]	= "";
 static char opt_cdup[SIZEOF_STR]	= "";
 static char opt_git_dir[SIZEOF_STR]	= "";
-static char opt_is_inside_work_tree	= -1; /* set to TRUE or FALSE */
+static signed char opt_is_inside_work_tree	= -1; /* set to TRUE or FALSE */
 static char opt_editor[SIZEOF_STR]	= "";
 
 enum option_type {
-- 
1.5.4.4


-- 
Russell Steicke

-- Fortune says:
Everything I like is either illegal, immoral or fattening.
		-- Alexander Woollcott
Message 1 of 1 in “(tig) Fix signed char comparison where char is unsigned by default.”
  1. (tig) Fix signed char comparison where char is unsigned by default.Russell Steicke, Mar 18, 2008

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.