summaryrefslogtreecommitdiffhomepage
path: root/types.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-26 11:09:28 +0100
committerGitHub <noreply@github.com>2022-01-26 11:09:28 +0100
commit58e1da9b7dd69af0f32fb2a70c1808dce8c51733 (patch)
tree3150ccd20772ee2406d3024a9b930f6051f6c028 /types.c
parent134f575064c8a454354aead852533104642d2d5a (diff)
parent3f6d1998b60e2778730a925d2b761db3b54979fe (diff)
Merge pull request #35 from jow-/various-fixes
Various fixes
Diffstat (limited to 'types.c')
-rw-r--r--types.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/types.c b/types.c
index 68eba42..5ea1180 100644
--- a/types.c
+++ b/types.c
@@ -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));
}