Skip to content

Commit 7800491

Browse files
committed
Inline SKIP_LONG_HEADER... macro which is only used once
I don't find that pulling this code out into a macro makes anything clearer. Not at all.
1 parent 0b32a15 commit 7800491

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

ext/mbstring/mbstring.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,16 +3253,6 @@ PHP_FUNCTION(mb_decode_numericentity)
32533253
/* }}} */
32543254

32553255
/* {{{ Sends an email message with MIME scheme */
3256-
3257-
#define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \
3258-
if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \
3259-
pos += 2; \
3260-
while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \
3261-
pos++; \
3262-
} \
3263-
continue; \
3264-
}
3265-
32663256
static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t str_len)
32673257
{
32683258
const char *ps;
@@ -3567,15 +3557,20 @@ PHP_FUNCTION(mb_send_mail)
35673557
to_r[to_len - 1] = '\0';
35683558
}
35693559
for (i = 0; to_r[i]; i++) {
3570-
if (iscntrl((unsigned char) to_r[i])) {
3571-
/* According to RFC 822, section 3.1.1 long headers may be separated into
3572-
* parts using CRLF followed at least one linear-white-space character ('\t' or ' ').
3573-
* To prevent these separators from being replaced with a space, we use the
3574-
* SKIP_LONG_HEADER_SEP_MBSTRING to skip over them.
3575-
*/
3576-
SKIP_LONG_HEADER_SEP_MBSTRING(to_r, i);
3577-
to_r[i] = ' ';
3578-
}
3560+
if (iscntrl((unsigned char) to_r[i])) {
3561+
/* According to RFC 822, section 3.1.1 long headers may be separated into
3562+
* parts using CRLF followed at least one linear-white-space character ('\t' or ' ').
3563+
* To prevent these separators from being replaced with a space, we skip over them. */
3564+
if (to_r[i] == '\r' && to_r[i + 1] == '\n' && (to_r[i + 2] == ' ' || to_r[i + 2] == '\t')) {
3565+
i += 2;
3566+
while (to_r[i + 1] == ' ' || to_r[i + 1] == '\t') {
3567+
i++;
3568+
}
3569+
continue;
3570+
}
3571+
3572+
to_r[i] = ' ';
3573+
}
35793574
}
35803575
} else {
35813576
to_r = to;
@@ -3694,7 +3689,6 @@ PHP_FUNCTION(mb_send_mail)
36943689
}
36953690
}
36963691

3697-
#undef SKIP_LONG_HEADER_SEP_MBSTRING
36983692
#undef MAIL_ASCIIZ_CHECK_MBSTRING
36993693
#undef PHP_MBSTR_MAIL_MIME_HEADER1
37003694
#undef PHP_MBSTR_MAIL_MIME_HEADER2

0 commit comments

Comments
 (0)