diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 10:35:28 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 10:35:28 -0800 |
commit | 039913a8fe92b0f07b4bee418bc4df0ed85c7811 (patch) | |
tree | 166cc2ec8cbb89501207ac2ab1bf9e153b1a4852 /src | |
parent | ac73c7827650675f4bfe28fdef2a355b9950f2dc (diff) |
Small optimization in _scan_at.
If the input is null, we can just return 0.
Diffstat (limited to 'src')
-rw-r--r-- | src/scanners.re | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/scanners.re b/src/scanners.re index 00a0b12..befe7d0 100644 --- a/src/scanners.re +++ b/src/scanners.re @@ -6,10 +6,9 @@ bufsize_t _scan_at(bufsize_t (*scanner)(const unsigned char *), cmark_chunk *c, { bufsize_t res; unsigned char *ptr = (unsigned char *)c->data; - unsigned char zero = '\0'; if (ptr == NULL) { - res = scanner(&zero); + return 0; } else { unsigned char lim = ptr[c->len]; |