diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-26 11:09:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-26 11:09:28 +0100 |
commit | 58e1da9b7dd69af0f32fb2a70c1808dce8c51733 (patch) | |
tree | 3150ccd20772ee2406d3024a9b930f6051f6c028 /types.c | |
parent | 134f575064c8a454354aead852533104642d2d5a (diff) | |
parent | 3f6d1998b60e2778730a925d2b761db3b54979fe (diff) |
Merge pull request #35 from jow-/various-fixes
Various fixes
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1918,8 +1918,13 @@ ucv_compare(int how, uc_value_t *v1, uc_value_t *v2, int *deltap) double d1, d2; int8_t delta; - /* if both operands are strings, compare bytewise */ - if (t1 == UC_STRING && t2 == UC_STRING) { + /* at least one operand is null and we compare for equality or inequality ... */ + if ((!v1 || !v2) && (how == I_EQ || how == I_NE)) { + delta = (v1 != v2); + } + + /* ... otherwise if both operands are strings, compare bytewise ... */ + else if (t1 == UC_STRING && t2 == UC_STRING) { delta = strcmp(ucv_string_get(v1), ucv_string_get(v2)); } |