sfeed_curses: simplify uiprompt() - sfeed - RSS and Atom parser
HTML git clone git://git.codemadness.org/sfeed
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 830c6ae8a34a273fc4b185075f49bdd974705efa
DIR parent 5d823084a6a7be97aed3eeb0ea814e0e16b77437
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 27 Sep 2026 13:47:19 +0200
sfeed_curses: simplify uiprompt()
The temporary buffer and format with vsnprintf() is not needed.
Refactor and simplify the code.
Diffstat:
M sfeed_curses.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
---
DIR diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1011,25 +1011,20 @@ lineeditor(void)
}
static char *
-uiprompt(int x, int y, char *fmt, ...)
+uiprompt(int x, int y, const char *prompt)
{
- va_list ap;
- char *input, buf[32];
-
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
+ char *input;
cursorsave();
cursormove(x, y);
THEME_INPUT_LABEL();
- ttywrite(buf);
+ ttywrite(prompt);
attrmode(ATTR_RESET);
THEME_INPUT_NORMAL();
cleareol();
cursormode(1);
- cursormove(x + colw(buf) + 1, y);
+ cursormove(x + colw(prompt) + 1, y);
input = lineeditor();
attrmode(ATTR_RESET);
@@ -2214,10 +2209,9 @@ nextpage:
/* prompt for new input */
if (ch == '?' || ch == '/') {
- tmp = ch == '?' ? "backward" : "forward";
free(search);
search = uiprompt(statusbar.x, statusbar.y,
- "Search (%s):", tmp);
+ ch == '?' ? "Search (backward):" : "Search (forward):");
statusbar.dirty = 1;
}
if (!search || !p->nrows)