Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1dc321f

Browse files
author
Aleksander Alekseev
committed
Fix a silly bug in dict_find_match()
1 parent02db084 commit1dc321f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎zson.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,14 @@ dict_find_match(const Dict* pdict,
200200
size_tnbytes=pdict->words[current].nbytes;
201201

202202
if(nbytes>buff_size)
203-
res=1;// current is greater
204-
else
203+
{
204+
/* current can be less or greater depending on the prefix */
205+
res=memcmp(pdict->words[current].word,buff,buff_size);
206+
207+
/* if prefixes match, current is greater */
208+
if(res==0)
209+
res=1;
210+
}else
205211
res=memcmp(pdict->words[current].word,buff,nbytes);
206212

207213
if(res==0)// match

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp