diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-23 19:12:25 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-23 19:12:49 -0700 |
commit | 2411a2874c6ecdcbb0174685740863992593db11 (patch) | |
tree | 39baf6ecc9d770a42e0ae412214d9e4ef7ffd18c | |
parent | 8b163b84c3d3c7aaee881d63005c85f23a96f205 (diff) | |
download | pyscss-2411a2874c6ecdcbb0174685740863992593db11.tar.gz |
Correctly support scanning zero-length strings.
-rw-r--r-- | scss/src/scanner.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/scss/src/scanner.c b/scss/src/scanner.c index 988810a..b8fedef 100644 --- a/scss/src/scanner.c +++ b/scss/src/scanner.c @@ -303,16 +303,14 @@ Scanner_reset(Scanner *self, char *input, int input_sz) { } self->tokens_sz = 0; - if (input_sz) { - if (self->input != NULL) { - PyMem_Del(self->input); - } - self->input = PyMem_Strndup(input, input_sz); - self->input_sz = input_sz; - #ifdef DEBUG - fprintf(stderr, "Scanning in %s\n", repr(self->input)); - #endif + if (self->input != NULL) { + PyMem_Del(self->input); } + self->input = PyMem_Strndup(input, input_sz); + self->input_sz = input_sz; + #ifdef DEBUG + fprintf(stderr, "Scanning in %s\n", repr(self->input)); + #endif self->pos = 0; } |