diff options
-rw-r--r-- | src/common/sort.h | 3 | ||||
-rw-r--r-- | src/common/szbin.h | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/common/sort.h b/src/common/sort.h index 39a6f33..27e3739 100644 --- a/src/common/sort.h +++ b/src/common/sort.h @@ -37,6 +37,9 @@ int sort_boolean(bool, bool); /* Compare une valeur avec une autre. */ int sort_unsigned_long(unsigned long, unsigned long); +#define sort_size(v1, v2) \ + sort_unsigned_long(v1, v2) + /* Compare une valeur avec une autre. */ int sort_signed_long_long(signed long long, signed long long); diff --git a/src/common/szbin.h b/src/common/szbin.h index 182739a..8524ae3 100644 --- a/src/common/szbin.h +++ b/src/common/szbin.h @@ -143,15 +143,13 @@ typedef struct _sized_binary_t while (0) -#define memcmp_sized_binary(s1, s2) \ - ({ \ - int __ret; \ - size_t __n; \ - __n = (s1)->size < (s2)->size ? (s1)->size : (s2)->size; \ - __ret = memcmp((s1)->data, (s2)->data, __n); \ - if (__ret == 0) \ - __ret = sort_unsigned_long_long((s1)->size, (s2)->size);\ - __ret; \ +#define memcmp_sized_binary(s1, s2) \ + ({ \ + int __ret; \ + __ret = sort_size((s1)->size, (s2)->size); \ + if (__ret == 0) \ + __ret = memcmp((s1)->data, (s2)->data, (s1)->size); \ + __ret; \ }) |