From 8bf7ceef411da4d681ce8def96d3f4c06947b095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Fri, 12 Aug 2022 23:20:30 -0300 Subject: [PATCH] Clean up ef.c. Use do{ /*things*/ }while(0) for macro with code, update comments and remove unnecessary one. --- ef.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ef.c b/ef.c index 719c4a5..a4bdc0a 100644 --- a/ef.c +++ b/ef.c @@ -84,7 +84,6 @@ int main(int argc, char **argv) puts(get_entry(&entries, 0)); exit(0); } - /* end of fast exit cases */ sort_entries(&entries); filter_entries(&entries, NULL); @@ -167,8 +166,10 @@ int main(int argc, char **argv) mvwaddstr(prompt, 0, 0, "> "); wrefresh(prompt); - /* index in entries, index in matched */ - #define WRITELIST(idx, idxm) mvwaddstr(list, listsize - idxm - 1, 0, get_entry(&entries, idx)) + /* index in entries, index in matched; + * this function could include a wclrtoeol call, but that only hides indexing issues */ + #define WRITELIST(idx, idxm) \ + do{mvwaddstr(list, listsize - idxm - 1, 0, get_entry(&entries, idx));}while(0) /* inital dump of list */ for (size_t i = 0; i < entries.n; i++) {