Make read_one_header_line return a flag not a length.
Currently we only use the return value from read_one_header line to tell if the line we have read is a header or not. So make it a flag. This paves the way for better email detection. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric W. Biederman committed
May 23, 2006 at 13:44 UTC
f8128cfb8d5892e76611d024a19c1ecdace9a39e
1 file changed
+11
-11
mailinfo.c
+11
-11
@@ -331,7 +331,7 @@ struct header_def {
331
int namelen;
332
};
333
334
-static void check_header(char *line, int len, struct header_def *header)
334
+static void check_header(char *line, struct header_def *header)
335
{
336
int i;
337
@@ -349,7 +349,7 @@ static void check_header(char *line, int len, struct header_def *header)
349
}
350
}
351
352
-static void check_subheader_line(char *line, int len)
352
+static void check_subheader_line(char *line)
353
{
354
static struct header_def header[] = {
355
{ "Content-Type", handle_subcontent_type },
@@ -357,9 +357,9 @@ static void check_subheader_line(char *line, int len)
357
handle_content_transfer_encoding },
358
{ NULL },
359
};
360
- check_header(line, len, header);
360
+ check_header(line, header);
361
}
362
-static void check_header_line(char *line, int len)
362
+static void check_header_line(char *line)
363
{
364
static struct header_def header[] = {
365
{ "From", handle_from },
@@ -370,7 +370,7 @@ static void check_header_line(char *line, int len)
370
handle_content_transfer_encoding },
371
{ NULL },
372
};
373
- check_header(line, len, header);
373
+ check_header(line, header);
374
}
375
376
static int read_one_header_line(char *line, int sz, FILE *in)
@@ -709,8 +709,8 @@ static void handle_multipart_body(void)
709
return;
710
/* We are on boundary line. Start slurping the subhead. */
711
while (1) {
712
- int len = read_one_header_line(line, sizeof(line), stdin);
713
- if (!len) {
712
+ int hdr = read_one_header_line(line, sizeof(line), stdin);
713
+ if (!hdr) {
714
if (handle_multipart_one_part() < 0)
715
return;
716
/* Reset per part headers */
@@ -718,7 +718,7 @@ static void handle_multipart_body(void)
718
charset[0] = 0;
719
}
720
else
721
- check_subheader_line(line, len);
721
+ check_subheader_line(line);
722
}
723
fclose(patchfile);
724
if (!patch_lines) {
@@ -787,15 +787,15 @@ int main(int argc, char **argv)
787
exit(1);
788
}
789
while (1) {
790
- int len = read_one_header_line(line, sizeof(line), stdin);
791
- if (!len) {
790
+ int hdr = read_one_header_line(line, sizeof(line), stdin);
791
+ if (!hdr) {
792
if (multipart_boundary[0])
793
handle_multipart_body();
794
else
795
handle_body();
796
break;
797
}
798
- check_header_line(line, len);
798
+ check_header_line(line);
799
}
800
return 0;
801
}