diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Makefile.am | 1 | ||||
-rw-r--r-- | src/common/cpp.h | 2 | ||||
-rw-r--r-- | src/common/sort.h | 3 | ||||
-rw-r--r-- | src/common/szbin.h | 16 |
4 files changed, 13 insertions, 9 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am index d09b661..1056cb2 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -47,6 +47,7 @@ endif libcommon4_la_SOURCES = \ + array.h array.c \ asm.h asm.c \ bits.h bits.c \ compiler.h \ diff --git a/src/common/cpp.h b/src/common/cpp.h index 9616db3..4ebad82 100644 --- a/src/common/cpp.h +++ b/src/common/cpp.h @@ -48,6 +48,8 @@ */ #define SL(str) str, strlen(str) +#define STCSL(str) str, STATIC_STR_SIZE(str) + /** * Détermine la taille de la plus longue chaîne de caractères 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; \ }) |