]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mworker/cli: use a label to return errors
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 28 Nov 2023 16:28:07 +0000 (17:28 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 28 Nov 2023 18:12:32 +0000 (19:12 +0100)
Remove the returns in the function to end directly at the end label.

src/cli.c

index 24184287a733b5f596aabedc07b44f8ee8d097ac..94f22974511dbe24190501b505d3e1102a68e0e8 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2605,13 +2605,15 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int
 
        /* there is no end to this command, need more to parse ! */
        if (!reql || *(end-1) != '\n') {
-               return -1;
+               ret = -1;
+               goto end;
        }
 
        if (s->pcli_flags & PCLI_F_PAYLOAD) {
                if (reql == 1) /* last line of the payload */
                        s->pcli_flags &= ~PCLI_F_PAYLOAD;
-               return reql;
+               ret = reql;
+               goto end;
        }
 
        *(end-1) = '\0';
@@ -2674,7 +2676,8 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int
                ret = end - trim;
        } else if (wtrim < 0) {
                /* parsing error */
-               return -1;
+               ret = -1;
+               goto end;
        } else {
                /* the whole string */
                ret = end - str;