]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-mailinfo.c
Merge branch 'lt/approxidate'
[git.git] / builtin-mailinfo.c
index fb5ad70f3fddeb560fbd045e1112a0bc739b6c9e..b0b5d8f6cb5107f3422d6107fd56f35ef62786f6 100644 (file)
@@ -221,8 +221,6 @@ static void cleanup_subject(struct strbuf *subject)
 {
        char *pos;
        size_t remove;
-       int brackets_removed = 0;
-
        while (subject->len) {
                switch (*subject->buf) {
                case 'r': case 'R':
@@ -237,15 +235,10 @@ static void cleanup_subject(struct strbuf *subject)
                        strbuf_remove(subject, 0, 1);
                        continue;
                case '[':
-                       /* remove only one set of square brackets */
-                       if (brackets_removed)
-                               break;
-
                        if ((pos = strchr(subject->buf, ']'))) {
                                remove = pos - subject->buf;
                                if (remove <= (subject->len - remove) * 2) {
                                        strbuf_remove(subject, 0, remove + 1);
-                                       brackets_removed = 1;
                                        continue;
                                }
                        } else
@@ -772,7 +765,6 @@ static void handle_filter(struct strbuf *line)
 
 static void handle_body(void)
 {
-       int len = 0;
        struct strbuf prev = STRBUF_INIT;
 
        /* Skip up to the first boundary */
@@ -782,8 +774,6 @@ static void handle_body(void)
        }
 
        do {
-               strbuf_setlen(&line, line.len + len);
-
                /* process any boundary lines */
                if (*content_top && is_multipart_boundary(&line)) {
                        /* flush any leftover */
@@ -839,10 +829,7 @@ static void handle_body(void)
                        handle_filter(&line);
                }
 
-               strbuf_reset(&line);
-               if (strbuf_avail(&line) < 100)
-                       strbuf_grow(&line, 100);
-       } while ((len = read_line_with_nul(line.buf, strbuf_avail(&line), fin)));
+       } while (!strbuf_getwholeline(&line, fin, '\n'));
 
 handle_body_out:
        strbuf_release(&prev);