diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-14 01:43:01 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-14 01:43:01 +0300 |
commit | 59e269cfec51b6a7933d6e847a38c84c04056675 (patch) | |
tree | d398b54d687d9cfce31d8ea5cdca2ba7dece354c /py/objstr.c | |
parent | 14de114ba811614ba6e058f6d864129f5c8b73bb (diff) |
qstr, objstr: Make sure that valid hash != 0, treat 0 as "not computed".
This feature was proposed with initial hashing RFC, and is prerequisite for
seamless static str object definition.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/py/objstr.c b/py/objstr.c index d933fa5e3..0f9e4fdda 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1463,7 +1463,8 @@ bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) { } else { GET_STR_HASH(s1, h1); GET_STR_HASH(s2, h2); - if (h1 != h2) { + // If any of hashes is 0, it means it's not valid + if (h1 != 0 && h2 != 0 && h1 != h2) { return false; } GET_STR_DATA_LEN(s1, d1, l1); |