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

[PATCH 1/5] environment: normalize use of prefixcmp() by removing " != 0"

From
Christian Couder <chriscool@tuxfamily.org>
Date
Dec 1, 2013, 07:49 UTC
Message-ID
<20131201074919.3042.88989.chriscool@tuxfamily.org>
In-Reply-To
<20131201074818.3042.57357.chriscool@tuxfamily.org>

To be able to automatically convert prefixcmp() to starts_with() we need first to make sure that prefixcmp() is always used in the same way.

So let's remove " != 0" after prefixcmp().
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 environment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/environment.c b/environment.c
index 0a15349..cd2b068 100644
--- a/environment.c
+++ b/environment.c
@@ -171,7 +171,7 @@ const char *get_git_namespace(void)
 
 const char *strip_namespace(const char *namespaced_ref)
 {
-	if (prefixcmp(namespaced_ref, get_git_namespace()) != 0)
+	if (prefixcmp(namespaced_ref, get_git_namespace()))
 		return NULL;
 	return namespaced_ref + namespace_len;
 }
-- 
1.8.4.1.561.g12affca
Previous: Christian CouderNext: Christian Couder
Message 2 of 17 in “use starts_with() and ends_with()”
  1. 0/5 use starts_with() and ends_with()Christian Couder, Dec 1, 2013
  2. 1/5 environment: normalize use of prefixcmp() by removing " != 0"Christian Couder, Dec 1, 2013
  3. 2/5 builtin/remote: remove postfixcmp() and use suffixcmp() insteadChristian Couder, Dec 1, 2013
  4. 3/5 strbuf: introduce starts_with() and ends_with()Christian Couder, Dec 1, 2013
  5. 5/5 strbuf: remove prefixcmp() and suffixcmp()Christian Couder, Dec 1, 2013
  6. Jeff KingDec 2, 2013
  7. Junio C HamanoDec 2, 2013
  8. Christian CouderDec 2, 2013
  9. Antoine PelisseDec 2, 2013
  10. Christian CouderDec 3, 2013
  11. Jeff KingDec 3, 2013
  12. Christian CouderDec 3, 2013
  13. Jeff KingDec 4, 2013
  14. Junio C HamanoDec 4, 2013
  15. Junio C HamanoDec 4, 2013
  16. Christian CouderDec 5, 2013
  17. Junio C HamanoDec 5, 2013

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.