From dd38c3777798917d5d1b04723382bae18c71cc01 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Tue, 28 Nov 2023 17:28:07 +0100 Subject: [PATCH] CLEANUP: mworker/cli: use a label to return errors Remove the returns in the function to end directly at the end label. --- src/cli.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cli.c b/src/cli.c index 24184287a7..94f2297451 100644 --- 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; -- 2.47.3