diff options
author | Daniel Gustafsson <daniel@yesql.se> | 2019-01-20 21:59:04 +0100 |
---|---|---|
committer | Daniel Gustafsson <daniel@yesql.se> | 2019-01-20 21:59:04 +0100 |
commit | f0b2c13a9eb897374cc5d8f6f94d434820b01f9e (patch) | |
tree | 74a5464875cc14ec5678ec19d130e04408ed979b /lib/imap.c | |
parent | 6bd5bc97f4d28e8d1b5593d1678ab2dbf23f34bf (diff) | |
download | curl-f0b2c13a9eb897374cc5d8f6f94d434820b01f9e.tar.gz |
memcmp: avoid doing single char memcmp
There is no real gain in performing memcmp() comparisons on single
characters, so change these to array subscript inspections which
saves a call and makes the code clearer.
Closes #3486
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Jay Satiro <raysatiro@yahoo.com>
Diffstat (limited to 'lib/imap.c')
-rw-r--r-- | lib/imap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c index 161b28983..5d96900f8 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -316,7 +316,7 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len, a space and optionally some text as per RFC-3501 for the AUTHENTICATE and APPEND commands and as outlined in Section 4. Examples of RFC-4959 but some e-mail servers ignore this and only send a single + instead. */ - if(imap && !imap->custom && ((len == 3 && !memcmp("+", line, 1)) || + if(imap && !imap->custom && ((len == 3 && line[0] == '+') || (len >= 2 && !memcmp("+ ", line, 2)))) { switch(imapc->state) { /* States which are interested in continuation responses */ |