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

[PATCH 2/3] diff_scoreopt_parse(): use skip_prefix_if_present()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 5, 2014, 06:25 UTC
Message-ID
<1391581517-8586-3-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1391581517-8586-1-git-send-email-mhagger@alum.mit.edu>

Whenever skip_prefix_defval() was called, opt was still equal to *opt_p. So we can use skip_prefix_if_present() instead.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 diff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
index d629cc5..a07fe9d 100644
--- a/diff.c
+++ b/diff.c
@@ -3890,13 +3890,13 @@ static int diff_scoreopt_parse(const char **opt_p)
 	*opt_p = opt;
 	if (cmd == '-') {
 		/* convert the long-form arguments into short-form versions */
-		if ((opt = skip_prefix_defval(opt, "break-rewrites", *opt_p)) != *opt_p) {
+		if ((opt = skip_prefix_if_present(opt, "break-rewrites")) != *opt_p) {
 			if (*opt == 0 || *opt++ == '=')
 				cmd = 'B';
-		} else if ((opt = skip_prefix_defval(opt, "find-copies", *opt_p)) != *opt_p) {
+		} else if ((opt = skip_prefix_if_present(opt, "find-copies")) != *opt_p) {
 			if (*opt == 0 || *opt++ == '=')
 				cmd = 'C';
-		} else if ((opt = skip_prefix_defval(opt, "find-renames", *opt_p)) != *opt_p) {
+		} else if ((opt = skip_prefix_if_present(opt, "find-renames")) != *opt_p) {
 			if (*opt == 0 || *opt++ == '=')
 				cmd = 'M';
 		}
-- 
1.8.5.3
Previous: Michael HaggertyNext: Michael Haggerty
Message 3 of 7 in “Add a function skip_prefix_if_present()”
  1. 0/3 Add a function skip_prefix_if_present()Michael Haggerty, Feb 5, 2014
  2. 1/3 Add and use a function skip_prefix_if_present()Michael Haggerty, Feb 5, 2014
  3. 2/3 diff_scoreopt_parse(): use skip_prefix_if_present()Michael Haggerty, Feb 5, 2014
  4. 3/3 rev_is_head(): use skip_prefix()Michael Haggerty, Feb 5, 2014
  5. Michael HaggertyFeb 5, 2014
  6. Jeff KingFeb 5, 2014
  7. Duy NguyenFeb 6, 2014

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.