585
return item->conf.name;
586
}
587
588
-static int token_matches_item(const char *tok, struct arg_item *item, int tok_len)
588
+static int token_matches_item(const char *tok, struct arg_item *item, size_t tok_len)
589
{
590
if (!strncasecmp(tok, item->conf.name, tok_len))
591
return 1;
603
* distinguished from the non-well-formed-line case (in which this function
604
* returns -1) because some callers of this function need such a distinction.
605
*/
606
-static int find_separator(const char *line, const char *separators)
606
+static ssize_t find_separator(const char *line, const char *separators)
607
{
608
int whitespace_found = 0;
609
const char *c;
630
*/
631
static void parse_trailer(struct strbuf *tok, struct strbuf *val,
632
const struct conf_info **conf, const char *trailer,
633
- int separator_pos)
633
+ ssize_t separator_pos)
634
{
635
struct arg_item *item;
636
- int tok_len;
636
+ size_t tok_len;
637
struct list_head *pos;
638
639
if (separator_pos != -1) {
721
list_for_each(pos, new_trailer_head) {
722
struct new_trailer_item *tr =
723
list_entry(pos, struct new_trailer_item, list);
724
- int separator_pos = find_separator(tr->text, cl_separators);
724
+ ssize_t separator_pos = find_separator(tr->text, cl_separators);
725
726
if (separator_pos == 0) {
727
struct strbuf sb = STRBUF_INIT;
763
/*
764
* Return the position of the start of the last line. If len is 0, return -1.
765
*/
766
-static int last_line(const char *buf, size_t len)
766
+static ssize_t last_line(const char *buf, size_t len)
767
{
768
- int i;
768
+ ssize_t i;
769
if (len == 0)
770
return -1;
771
if (len == 1)
788
* Return the position of the start of the patch or the length of str if there
789
* is no patch in the message.
790
*/
791
-static int find_patch_start(const char *str)
791
+static size_t find_patch_start(const char *str)
792
{
793
const char *s;
794
804
* Return the position of the first trailer line or len if there are no
805
* trailers.
806
*/
807
-static int find_trailer_start(const char *buf, size_t len)
807
+static size_t find_trailer_start(const char *buf, size_t len)
808
{
809
const char *s;
810
- int end_of_title, l, only_spaces = 1;
810
+ ssize_t end_of_title, l;
811
+ int only_spaces = 1;
812
int recognized_prefix = 0, trailer_lines = 0, non_trailer_lines = 0;
813
/*
814
* Number of possible continuation lines encountered. This will be
839
l = last_line(buf, l)) {
840
const char *bol = buf + l;
841
const char **p;
841
- int separator_pos;
842
+ ssize_t separator_pos;
843
844
if (bol[0] == comment_line_char) {
845
non_trailer_lines += possible_continuation_lines;
900
}
901
902
/* Return the position of the end of the trailers. */
902
-static int find_trailer_end(const char *buf, size_t len)
903
+static size_t find_trailer_end(const char *buf, size_t len)
904
{
905
return len - ignore_non_trailer(buf, len);
906
}
907
908
static int ends_with_blank_line(const char *buf, size_t len)
909
{
909
- int ll = last_line(buf, len);
910
+ ssize_t ll = last_line(buf, len);
911
if (ll < 0)
912
return 0;
913
return is_blank_line(buf + ll);
940
strbuf_release(&out);
941
}
942
942
-static int process_input_file(FILE *outfile,
943
- const char *str,
944
- struct list_head *head,
945
- const struct process_trailer_options *opts)
943
+static size_t process_input_file(FILE *outfile,
944
+ const char *str,
945
+ struct list_head *head,
946
+ const struct process_trailer_options *opts)
947
{
948
struct trailer_info info;
949
struct strbuf tok = STRBUF_INIT;
1033
{
1034
LIST_HEAD(head);
1035
struct strbuf sb = STRBUF_INIT;
1035
- int trailer_end;
1036
+ size_t trailer_end;
1037
FILE *outfile = stdout;
1038
1039
ensure_configured();
1133
1134
for (i = 0; i < info->trailer_nr; i++) {
1135
char *trailer = info->trailers[i];
1135
- int separator_pos = find_separator(trailer, separators);
1136
+ ssize_t separator_pos = find_separator(trailer, separators);
1137
1138
if (separator_pos >= 1) {
1139
struct strbuf tok = STRBUF_INIT;