]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: imap_envelope_parse() - remove unnecessary data stack frame
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 15 Nov 2017 13:53:03 +0000 (15:53 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 15 Nov 2017 13:53:03 +0000 (15:53 +0200)
imap_envelope_parse_args() isn't using data stack at all, so this
unnecessarily complicates the code. It also prevents using datastack-pool
as the pool parameter.

src/lib-imap/imap-envelope.c

index 389adeb5b950783a5e48d70051f6781f144f3d19..da8ccdecfc2cad25e3ae5124b3934236a05988c7 100644 (file)
@@ -222,7 +222,6 @@ bool imap_envelope_parse(const char *envelope,
        struct istream *input;
        struct imap_parser *parser;
        const struct imap_arg *args;
-       char *error = NULL;
        int ret;
 
        input = i_stream_create_from_data(envelope, strlen(envelope));
@@ -238,18 +237,8 @@ bool imap_envelope_parse(const char *envelope,
                *error_r = "Empty envelope";
                ret = -1;
        } else {
-               T_BEGIN {
-                       if (!imap_envelope_parse_args
-                               (args, pool, envlp_r, error_r)) {
-                               error = i_strdup(*error_r);
-                               ret = -1;
-                       }
-               } T_END;
-
-               if (ret < 0) {
-                       *error_r = t_strdup(error);
-                       i_free(error);
-               }
+               if (!imap_envelope_parse_args(args, pool, envlp_r, error_r))
+                       ret = -1;
        }
 
        imap_parser_unref(&parser);