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

[PATCH 3/3] apply, find_name_traditional: Do not initialize len to the lines length.

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Jul 18, 2013, 21:35 UTC
Message-ID
<1374183327-14939-3-git-send-email-stefanbeller@googlemail.com>
In-Reply-To
<1374183327-14939-1-git-send-email-stefanbeller@googlemail.com>

The variable len is set to len = strchrnul(line, '\n') - line; unconditionally 9 lines later, hence we can remove the call to strlen.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 builtin/apply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 1218688..681a40b 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -722,7 +722,7 @@ static char *find_name(const char *line, char *def, int p_value, int terminate)
 
 static char *find_name_traditional(const char *line, char *def, int p_value)
 {
-	size_t len = strlen(line);
+	size_t len;
 	size_t date_len;
 
 	if (*line == '"') {
-- 
1.8.3.3.754.g9c3c367.dirty
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 8 in “treewalk.c: Rename variable ret to cb_bits and remove some dead lines.”
  1. 1/3 treewalk.c: Rename variable ret to cb_bits and remove some dead lines.Stefan Beller, Jul 18, 2013
  2. 2/3 http-push.c, add_send_request: Do not initialize transfer_request.Stefan Beller, Jul 18, 2013
  3. Junio C HamanoJul 19, 2013
  4. 3/3 apply, find_name_traditional: Do not initialize len to the lines length.Stefan Beller, Jul 18, 2013
  5. Junio C HamanoJul 19, 2013
  6. Stefan BellerJul 19, 2013
  7. traverse_trees(): clarify return value of the callback.Stefan Beller, Jul 19, 2013
  8. Junio C HamanoJul 19, 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.