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

[PATCH v2 2/3] diff.c: delete unused functions

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 22, 2019, 00:30 UTC
Message-ID
<20190122003020.9672-3-pclouds@gmail.com>
In-Reply-To
<20190122003020.9672-1-pclouds@gmail.com>

After the parseopt conversion, a few functions are no longer needed. Delete them.

Noticed-by: SZEDER Gábor <szeder.dev@gmail.com>
Noticed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 diff.c | 65 ----------------------------------------------------------
 1 file changed, 65 deletions(-)
diff --git a/diff.c b/diff.c
index 747e691190..da5ba835ce 100644
--- a/diff.c
+++ b/diff.c
@@ -104,11 +104,6 @@ static const char *color_diff_slots[] = {
 	[DIFF_FILE_NEW_BOLD]	      = "newBold",
 };
 
-static NORETURN void die_want_option(const char *option_name)
-{
-	die(_("option '%s' requires a value"), option_name);
-}
-
 define_list_config_array_extra(color_diff_slots, {"plain"});
 
 static int parse_diff_color_slot(const char *var)
@@ -4578,66 +4573,6 @@ void diff_setup_done(struct diff_options *options)
 	FREE_AND_NULL(options->parseopts);
 }
 
-static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *val)
-{
-	char c, *eq;
-	int len;
-
-	if (*arg != '-')
-		return 0;
-	c = *++arg;
-	if (!c)
-		return 0;
-	if (c == arg_short) {
-		c = *++arg;
-		if (!c)
-			return 1;
-		if (val && isdigit(c)) {
-			char *end;
-			int n = strtoul(arg, &end, 10);
-			if (*end)
-				return 0;
-			*val = n;
-			return 1;
-		}
-		return 0;
-	}
-	if (c != '-')
-		return 0;
-	arg++;
-	eq = strchrnul(arg, '=');
-	len = eq - arg;
-	if (!len || strncmp(arg, arg_long, len))
-		return 0;
-	if (*eq) {
-		int n;
-		char *end;
-		if (!isdigit(*++eq))
-			return 0;
-		n = strtoul(eq, &end, 10);
-		if (*end)
-			return 0;
-		*val = n;
-	}
-	return 1;
-}
-
-static inline int short_opt(char opt, const char **argv,
-			    const char **optarg)
-{
-	const char *arg = argv[0];
-	if (arg[0] != '-' || arg[1] != opt)
-		return 0;
-	if (arg[2] != '\0') {
-		*optarg = arg + 2;
-		return 1;
-	}
-	if (!argv[1])
-		die("Option '%c' requires a value", opt);
-	*optarg = argv[1];
-	return 2;
-}
-
 int parse_long_opt(const char *opt, const char **argv,
 		   const char **optarg)
 {
-- 
2.20.1.560.g70ca8b83ee
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 9 of 10 in “nd/diff-parseopt fixups”
  1. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  2. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  3. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 2019
  4. Junio C HamanoJan 22, 2019
  5. Junio C HamanoJan 22, 2019
  6. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  7. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  8. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  9. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  10. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 2019

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.