diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-01-11 17:31:26 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-01-11 17:31:26 +0300 |
commit | 37d3605fa07c00a68ac2bae867a70b5299303220 (patch) | |
tree | cc9d7b1c1092eb0c79b2f02e76a31a1cf27edef6 /src/tokenizers/tokenizers.c | |
parent | f7639eb2dc2373dd4a47eb93efed0646c4a41fb5 (diff) | |
download | rspamd-37d3605fa07c00a68ac2bae867a70b5299303220.tar.gz rspamd-37d3605fa07c00a68ac2bae867a70b5299303220.zip |
* Fix errors in learning implementation
Diffstat (limited to 'src/tokenizers/tokenizers.c')
-rw-r--r-- | src/tokenizers/tokenizers.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tokenizers/tokenizers.c b/src/tokenizers/tokenizers.c index 853207af4..280ebd477 100644 --- a/src/tokenizers/tokenizers.c +++ b/src/tokenizers/tokenizers.c @@ -50,14 +50,14 @@ get_next_word (f_str_t *buf, f_str_t *token) token->begin = buf->begin; } + token->begin = token->begin + token->len; + token->len = 0; + remain = buf->len - (token->begin - buf->begin); if (remain <= 0) { return NULL; } - token->begin = token->begin + token->len; - token->len = 0; - pos = token->begin; /* Skip non graph symbols */ while (remain-- && !g_ascii_isgraph (*pos ++)) { @@ -66,6 +66,10 @@ get_next_word (f_str_t *buf, f_str_t *token) while (remain-- && g_ascii_isgraph (*pos ++)) { token->len ++; } + + if (token->len == 0) { + return NULL; + } return token; } |