1
0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-11-23 04:51:59 +01:00

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
This commit is contained in:
Connor Kuehl 2020-10-31 17:51:39 -05:00 committed by Drew DeVault
parent 514cb37301
commit c036a43801

@ -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]);