cosmopolitan/libc/str/slice.h

24 lines
696 B
C
Raw Normal View History

2021-08-14 13:17:56 +00:00
#ifndef COSMOPOLITAN_LIBC_STR_SLICE_H_
#define COSMOPOLITAN_LIBC_STR_SLICE_H_
2023-11-16 04:57:18 +00:00
#include "libc/stdbool.h"
2021-08-14 13:17:56 +00:00
#include "libc/str/str.h"
COSMOPOLITAN_C_START_
#define SlicesEqual(a, n, b, m) \
({ \
size_t __n = (n); \
__n == (m) && !memcmp(a, b, __n); \
})
2021-08-14 13:17:56 +00:00
#define SlicesEqualCase(a, n, b, m) \
({ \
size_t __n = (n); \
__n == (m) && !memcasecmp(a, b, __n); \
})
2021-08-14 13:17:56 +00:00
int CompareSlices(const char *, size_t, const char *, size_t);
int CompareSlicesCase(const char *, size_t, const char *, size_t);
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_STR_SLICE_H_ */