* Initialize StateC._empty_token to 0, to avoid undefined behaviour.

This commit is contained in:
Matthew Honnibal 2016-02-06 13:34:38 +01:00
parent 1b41f868d2
commit 4412a70dc5
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,6 @@ from ..symbols cimport punct
from ..attrs cimport IS_SPACE from ..attrs cimport IS_SPACE
cdef cppclass StateC: cdef cppclass StateC:
int* _stack int* _stack
int* _buffer int* _buffer
@ -48,6 +47,7 @@ cdef cppclass StateC:
this._e_i = 0 this._e_i = 0
for i in range(length): for i in range(length):
this._buffer[i] = i this._buffer[i] = i
memset(&this._empty_token, 0, sizeof(TokenC))
this._empty_token.lex = &EMPTY_LEXEME this._empty_token.lex = &EMPTY_LEXEME
for i in range(length): for i in range(length):
this._sent[i] = sent[i] this._sent[i] = sent[i]