← Commit list

0002184015

Daniel Stenberg
Daniel Stenberg
2026-01-19
SUCCESS Duration: 635s

Subject

imap: simplify imap_is_bchar() with strchr()

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/imap.c+2 -33
@@ -1677,40 +1677,9 @@ static void imap_easy_reset(struct IMAP *imap)
*/
static bool imap_is_bchar(char ch)
{
- /* Performing the alnum check with this macro is faster because of ASCII
+ /* Performing the alnum check first with macro is faster because of ASCII
arithmetic */
- if(ISALNUM(ch))
- return TRUE;
-
- switch(ch) {
- /* bchar */
- case ':':
- case '@':
- case '/':
- /* bchar -> achar */
- case '&':
- case '=':
- /* bchar -> achar -> uchar -> unreserved (without alphanumeric) */
- case '-':
- case '.':
- case '_':
- case '~':
- /* bchar -> achar -> uchar -> sub-delims-sh */
- case '!':
- case '$':
- case '\'':
- case '(':
- case ')':
- case '*':
- case '+':
- case ',':
- /* bchar -> achar -> uchar -> pct-encoded */
- case '%': /* HEXDIG chars are already included above */
- return TRUE;
-
- default:
- return FALSE;
- }
+ return ch && (ISALNUM(ch) || strchr(":@/&=-._~!$\'()*+,%", ch));
}
/***********************************************************************