cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit c036a43801d60b620262687e4bb6d98f97e23dbd
parent 514cb373019e94f743424b2813602722ca09b917
Author: Connor Kuehl <cipkuehl@gmail.com>
Date:   Sat, 31 Oct 2020 17:51:39 -0500

Initialize result if res != GEMINI_OK

My compiler barks about this unitialized variable:

CC	src/gmnlm.o
src/gmnlm.c:629:7: error: variable 'result' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (res != GEMINI_OK) {
                    ^~~~~~~~~~~~~~~~
src/gmnlm.c:673:9: note: uninitialized use occurs here
        return result;
               ^~~~~~
src/gmnlm.c:629:3: note: remove the 'if' if its condition is always false
                if (res != GEMINI_OK) {
                ^~~~~~~~~~~~~~~~~~~~~~~
src/gmnlm.c:482:2: note: variable 'result' is declared here
        enum prompt_result result;
        ^
1 error generated.
make: *** [src/gmnlm.o] Error 1

Diffstat:
Msrc/gmnlm.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -629,6 +629,7 @@ do_prompts(const char *prompt, struct browser *browser) if (res != GEMINI_OK) { fprintf(stderr, "Error: %s\n", gemini_strerr(res, &resp)); + result = PROMPT_AGAIN; goto exit; } pipe_resp(browser->tty, resp, &in[1]);