[PECL-CVS] [pecl-mail-mailparse] fix/gh20-content-id-parentheses: Copilot is too picky
[email protected] (Rasmus Lerdorf) Sun, 5 Apr 2026 11:39:48 +0000
| Newsgroups | php.pecl.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-05T07:39:42-04:00
Commit: https://github.com/php/pecl-mail-mailparse/commit/b78bf392fb595d1134517e3ffca18e13afbbbfc8
Raw diff: https://github.com/php/pecl-mail-mailparse/commit/b78bf392fb595d1134517e3ffca18e13afbbbfc8.diff
Copilot is too picky
Changed paths:
M mailparse.c
Diff:
diff --git a/mailparse.c b/mailparse.c
index c0459f4..6be50a9 100644
--- a/mailparse.c
+++ b/mailparse.c
@@ -1527,8 +1527,13 @@ static int mailparse_get_part_data(php_mimepart *part, zval *return_value)
id = Z_STRVAL_P(content_id);
len = Z_STRLEN_P(content_id);
- while (len > 0 && (id[0] == ' ' || id[0] == '\t')) { id++; len--; }
- while (len > 0 && (id[len-1] == ' ' || id[len-1] == '\t')) { len--; }
+ while (len > 0 && (id[0] == ' ' || id[0] == '\t')) {
+ id++;
+ len--;
+ }
+ while (len > 0 && (id[len-1] == ' ' || id[len-1] == '\t')) {
+ len--;
+ }
if (len >= 2 && id[0] == '<') {
close = memchr(id + 1, '>', len - 1);
@@ -1538,8 +1543,13 @@ static int mailparse_get_part_data(php_mimepart *part, zval *return_value)
/* Malformed: '<' without '>' — skip the '<' and trim */
id++;
len--;
- while (len > 0 && (id[0] == ' ' || id[0] == '\t')) { id++; len--; }
- while (len > 0 && (id[len-1] == ' ' || id[len-1] == '\t')) { len--; }
+ while (len > 0 && (id[0] == ' ' || id[0] == '\t')) {
+ id++;
+ len--;
+ }
+ while (len > 0 && (id[len-1] == ' ' || id[len-1] == '\t')) {
+ len--;
+ }
add_assoc_stringl(return_value, "content-id", id, len);
}
} else {