MCPcopy Create free account
hub / github.com/git/git / check_header

Function check_header

mailinfo.c:583–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583static int check_header(struct mailinfo *mi,
584 const struct strbuf *line,
585 struct strbuf *hdr_data[], int overwrite)
586{
587 int i, ret = 0;
588 struct strbuf sb = STRBUF_INIT;
589
590 /* search for the interesting parts */
591 for (i = 0; i < ARRAY_SIZE(header); i++) {
592 if ((!hdr_data[i] || overwrite) &&
593 parse_header(line, header[i], mi, &sb)) {
594 handle_header(&hdr_data[i], &sb);
595 ret = 1;
596 goto check_header_out;
597 }
598 }
599
600 /* Content stuff */
601 if (parse_header(line, "Content-Type", mi, &sb)) {
602 handle_content_type(mi, &sb);
603 ret = 1;
604 goto check_header_out;
605 }
606 if (parse_header(line, "Content-Transfer-Encoding", mi, &sb)) {
607 handle_content_transfer_encoding(mi, &sb);
608 ret = 1;
609 goto check_header_out;
610 }
611 if (parse_header(line, "Message-ID", mi, &sb)) {
612 if (mi->add_message_id)
613 mi->message_id = strbuf_detach(&sb, NULL);
614 ret = 1;
615 goto check_header_out;
616 }
617
618check_header_out:
619 strbuf_release(&sb);
620 return ret;
621}
622
623/*
624 * Returns 1 if the given line or any line beginning with the given line is an

Callers 3

handle_boundaryFunction · 0.70
mailinfoFunction · 0.70

Calls 6

parse_headerFunction · 0.85
strbuf_detachFunction · 0.85
strbuf_releaseFunction · 0.85
handle_headerFunction · 0.70
handle_content_typeFunction · 0.70

Tested by

no test coverage detected