[gmime] Slight parser optimization and additional check
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Slight parser optimization and additional check
- Date: Sun, 19 Mar 2017 17:41:16 +0000 (UTC)
commit 3fff045f1b5bae891a8f167f1c7c89decbfcfbdf
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Sun Mar 19 09:49:17 2017 -0400
Slight parser optimization and additional check
The additional check makes sure that 'aligned'
doesn't happen to fall on a '\n' character.
gmime/gmime-parser.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c
index 31201cc..c460ce6 100644
--- a/gmime/gmime-parser.c
+++ b/gmime/gmime-parser.c
@@ -1516,6 +1516,7 @@ parser_scan_content (GMimeParser *parser, GByteArray *content, guint *crlf)
size_t atleast;
int found = 0;
int mask;
+ char c;
d(printf ("scan-content\n"));
@@ -1554,10 +1555,15 @@ parser_scan_content (GMimeParser *parser, GByteArray *content, guint *crlf)
start = inptr;
/* Note: see optimization comment [1] */
- while (inptr < aligned && *inptr != '\n')
+ c = *aligned;
+ *aligned = '\n';
+
+ while (*inptr != '\n')
inptr++;
- if (inptr == aligned) {
+ *aligned = c;
+
+ if (inptr == aligned && c != '\n') {
dword = (int *) inptr;
do {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]