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_
|
|
|
|
|
2022-06-20 11:32:25 +00:00
|
|
|
#define SlicesEqual(a, n, b, m) \
|
|
|
|
({ \
|
|
|
|
size_t __n = (n); \
|
|
|
|
__n == (m) && !memcmp(a, b, __n); \
|
|
|
|
})
|
2021-08-14 13:17:56 +00:00
|
|
|
|
2022-06-20 11:32:25 +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_ */
|