From b88de80277d68e8d33a863976cb065029ef259ce Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Thu, 23 Dec 2021 22:16:11 -0500 Subject: [PATCH] refactor: Save a few lines here and there A couple of these are dicy in terms of better readability, but the maybe_startp was a good find! --- blag.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/blag.c b/blag.c index 9cee840..5645eba 100644 --- a/blag.c +++ b/blag.c @@ -143,10 +143,7 @@ int parse() { while ((c = getchar()) != EOF) { /* Handle Escapes before all else */ if (escape) { - if (in == NONE) { - in = PARAGRAPH; - printf("

\n"); - } + maybe_startp(); putesc(c); escape = false; continue; @@ -257,9 +254,7 @@ int parse() { if (in == NONE || !linestarted) { ol = c != '-'; in = LIST_PARSE; - } else if (in == LIST_PARSE) { - /* no op */ - } else { + } else if (in != LIST_PARSE) { putesc(c); } break; @@ -275,9 +270,7 @@ int parse() { break; } lastc = c; - if (c != '\n') { - linestarted = true; - } + linestarted = c != '\n'; } /* pretend there's a final LF to close any blocks */ handle_lf(); -- libgit2 1.1.1