← Commit list

3c957ad1fe

Daniel Stenberg
Daniel Stenberg
2026-01-20
SUCCESS Duration: 315s

Subject

lib: use ISBLANK and ISNEWLINE more

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+5 -11
@@ -437,13 +437,12 @@ static CURLcode imap_get_message(struct Curl_easy *data, struct bufref *out)
if(len > 2) {
/* Find the start of the message */
len -= 2;
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 2; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISNEWLINE(message[len]) && !ISBLANK(message[len]))
break;
/* Terminate the message */
@@ -1035,20 +1034,15 @@ static CURLcode imap_state_capability_resp(struct Curl_easy *data,
/* Loop through the data line */
for(;;) {
size_t wordlen;
- while(*line &&
- (*line == ' ' || *line == '\t' ||
- *line == '\r' || *line == '\n')) {
-
+ while(*line && (ISBLANK(*line) || ISNEWLINE(*line)))
line++;
- }
if(!*line)
break;
/* Extract the word */
- for(wordlen = 0; line[wordlen] && line[wordlen] != ' ' &&
- line[wordlen] != '\t' && line[wordlen] != '\r' &&
- line[wordlen] != '\n';)
+ for(wordlen = 0; line[wordlen] && !ISBLANK(line[wordlen]) &&
+ !ISNEWLINE(line[wordlen]);)
wordlen++;
/* Does the server support the STARTTLS capability? */
lib/pop3.c+2 -3
@@ -358,13 +358,12 @@ static CURLcode pop3_get_message(struct Curl_easy *data, struct bufref *out)
if(len > 2) {
/* Find the start of the message */
len -= 2;
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 2; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISBLANK(message[len]) && !ISNEWLINE(message[len]))
break;
/* Terminate the message */
lib/smtp.c+5 -10
@@ -547,13 +547,12 @@ static CURLcode smtp_get_message(struct Curl_easy *data, struct bufref *out)
if(len > 4) {
/* Find the start of the message */
len -= 4;
- for(message += 4; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 4; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISNEWLINE(message[len]) && !ISBLANK(message[len]))
break;
/* Terminate the message */
@@ -1234,10 +1233,7 @@ static CURLcode smtp_state_ehlo_resp(struct Curl_easy *data,
size_t wordlen;
unsigned short mechbit;
- while(len &&
- (*line == ' ' || *line == '\t' ||
- *line == '\r' || *line == '\n')) {
-
+ while(len && (ISBLANK(*line) || ISNEWLINE(*line))) {
line++;
len--;
}
@@ -1246,9 +1242,8 @@ static CURLcode smtp_state_ehlo_resp(struct Curl_easy *data,
break;
/* Extract the word */
- for(wordlen = 0; wordlen < len && line[wordlen] != ' ' &&
- line[wordlen] != '\t' && line[wordlen] != '\r' &&
- line[wordlen] != '\n';)
+ for(wordlen = 0; wordlen < len && !ISBLANK(line[wordlen]) &&
+ !ISNEWLINE(line[wordlen]);)
wordlen++;
/* Test the word for a matching authentication mechanism */