jdict

command line tool for looking up terms in yomidict dictionaries
git clone anongit@rnpnr.xyz:jdict.git
Log | Files | Refs | Feed | README | LICENSE

Commit: ab073161505c05f79206c99834238d6529b63be9
Parent: 1976310f098ae8e7babb49a468d41d86ee830e06
Author: Randy Palamar
Date:   Sun,  5 Nov 2023 17:38:41 -0700

yomidict: don't check if current position in data is NUL

data is not a string. Its a fixed length region of memory.

This gives some minor speedup (not worth documenting).

Diffstat:
Myomidict.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/yomidict.c b/yomidict.c @@ -85,7 +85,7 @@ number(YomiScanner *s, YomiTok *t) const char *d = s->data; ul start = s->pos; - for (; s->pos < s->len && d[s->pos]; s->pos++) { + for (; s->pos < s->len; s->pos++) { switch (d[s->pos]) { case ' ': case ',': @@ -118,7 +118,7 @@ yomi_scan(YomiScanner *s, YomiTok *toks, ul ntoks) if (toks == NULL) return -1; - for (; s->pos < s->len && s->data[s->pos]; s->pos++) { + for (; s->pos < s->len; s->pos++) { switch (s->data[s->pos]) { case '[': /* YOMI_ARRAY || YOMI_ENTRY */ count++;