commit d646a8f7a7d938fd0a0a3e45723b8668a9c9d431 from: Omar Polo date: Sun Jul 25 20:26:04 2021 UTC factorize the line type commit - a09aef7da470bbd81d4c5cd267a8b299990eed46 commit + d646a8f7a7d938fd0a0a3e45723b8668a9c9d431 blob - 46ef180b412797d8b711d722ee03998dcf4903b2 blob + 86b092a3593c75524d7ed6de641bb3d607a98b0b --- parser_textplain.c +++ parser_textplain.c @@ -29,14 +29,14 @@ static int textplain_foreach_line(struct parser*, cons static int textplain_free(struct parser*); static inline int -emit_line(struct parser *p, enum line_type type, const char *line, size_t len) +emit_line(struct parser *p, const char *line, size_t len) { struct line *l; if ((l = calloc(1, sizeof(*l))) == NULL) return 0; - l->type = type; + l->type = LINE_PRE_CONTENT; if (len != 0) { if ((l->line = calloc(1, len+1)) == NULL) { @@ -74,13 +74,13 @@ textplain_parse(struct parser *p, const char *buf, siz static int textplain_foreach_line(struct parser *p, const char *line, size_t linelen) { - return emit_line(p, LINE_PRE_CONTENT, line, linelen); + return emit_line(p, line, linelen); } static int textplain_free(struct parser *p) { if (p->len != 0) - return emit_line(p, LINE_PRE_CONTENT, p->buf, p->len); + return emit_line(p, p->buf, p->len); return 1; }