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

[PATCH 07/28] builtin-mailinfo.c cleanup

From
DRDavid Rientjes <rientjes@google.com>
Date
Aug 14, 2006, 20:24 UTC
Message-ID
<Pine.LNX.4.63.0608141323530.19383@chino.corp.google.com>
Makes decode_q_segment and decode_b_segment void and cleans up function calls.
		David
Signed-off-by: David Rientjes <rientjes@google.com>
---
 builtin-mailinfo.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 24a4fc6..bac3048 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -462,7 +462,7 @@ static unsigned hexval(int c)
 	return ~0;
 }
 
-static int decode_q_segment(char *in, char *ot, char *ep, int rfc2047)
+static void decode_q_segment(char *in, char *ot, char *ep, int rfc2047)
 {
 	int c;
 	while ((c = *in++) != 0 && (in <= ep)) {
@@ -478,10 +478,9 @@ static int decode_q_segment(char *in, ch
 		*ot++ = c;
 	}
 	*ot = 0;
-	return 0;
 }
 
-static int decode_b_segment(char *in, char *ot, char *ep)
+static void decode_b_segment(char *in, char *ot, char *ep)
 {
 	/* Decode in..ep, possibly in-place to ot */
 	int c, pos = 0, acc = 0;
@@ -525,7 +524,6 @@ static int decode_b_segment(char *in, ch
 		}
 	}
 	*ot = 0;
-	return 0;
 }
 
 static void convert_to_utf8(char *line, char *charset)
@@ -606,10 +604,12 @@ static int decode_header_bq(char *it)
 		default:
 			return rfc2047; /* no munging */
 		case 'b':
-			sz = decode_b_segment(cp + 3, piecebuf, ep);
+			decode_b_segment(cp + 3, piecebuf, ep);
+			sz = 0;
 			break;
 		case 'q':
-			sz = decode_q_segment(cp + 3, piecebuf, ep, 1);
+			decode_q_segment(cp + 3, piecebuf, ep, 1);
+			sz = 0;
 			break;
 		}
 		if (sz < 0)
@@ -746,9 +746,7 @@ static int handle_multipart_one_part(int
 		handle_patch();
 		break;
 	}
-	if (n == 0)
-		return -1;
-	return 0;
+	return n ? 0 : -1;
 }
 
 static void handle_multipart_body(void)
-- 
1.4.2.g89bb-dirty
Message 1 of 1 in “builtin-mailinfo.c cleanup”
  1. 07/28 builtin-mailinfo.c cleanupDavid Rientjes, Aug 14, 2006

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.