From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Stefan Beller" <sbeller@google.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 2/3] diff.c: delete unused functions
Date: Tue, 22 Jan 2019 07:30:19 +0700 [thread overview]
Message-ID: <20190122003020.9672-3-pclouds@gmail.com> (raw)
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
next prev parent reply other threads:[~2019-01-22 0:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 0:26 [PATCH 0/3] nd/diff-parseopt fixups Nguyễn Thái Ngọc Duy
2019-01-22 0:26 ` [PATCH 1/3] Revert "parse-options: allow keep-unknown + stop-at-non-opt combination" Nguyễn Thái Ngọc Duy
2019-01-22 0:26 ` [PATCH 2/3] diff.c: delete unused functions Nguyễn Thái Ngọc Duy
2019-01-22 0:26 ` [PATCH 3/3] diff.c: simplify diff_opt_break_rewrites() Nguyễn Thái Ngọc Duy
2019-01-22 20:50 ` Junio C Hamano
2019-01-22 23:18 ` Junio C Hamano
2019-01-22 0:30 ` [PATCH v2 0/3] nd/diff-parseopt fixups Nguyễn Thái Ngọc Duy
2019-01-22 0:30 ` [PATCH v2 1/3] Revert "parse-options: allow keep-unknown + stop-at-non-opt combination" Nguyễn Thái Ngọc Duy
2019-01-22 0:30 ` Nguyễn Thái Ngọc Duy [this message]
2019-01-22 0:30 ` [PATCH v2 3/3] diff.c: simplify diff_opt_break_rewrites() Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190122003020.9672-3-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sbeller@google.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).