Remove bool from public headers

This commit is contained in:
Justine Tunney 2023-11-15 20:57:18 -08:00
parent dffee606cf
commit 1351d3cede
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
55 changed files with 105 additions and 98 deletions

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool endswith(const char *s, const char *suffix) {
bool32 endswith(const char *s, const char *suffix) {
size_t n, m;
n = strlen(s);
m = strlen(suffix);

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool endswith16(const char16_t *s, const char16_t *suffix) {
bool32 endswith16(const char16_t *s, const char16_t *suffix) {
size_t n, m;
n = strlen16(s);
m = strlen16(suffix);

View file

@ -21,7 +21,7 @@
/**
* Returns true if buffer is most likely plaintext.
*/
bool istext(const void *data, size_t size) {
bool32 istext(const void *data, size_t size) {
const unsigned char *p, *pe;
for (p = data, pe = p + size; p < pe; ++p) {
if (*p <= 3) {

View file

@ -49,7 +49,7 @@ static const char kUtf8Dispatch[] = {
*
* @param size if -1 implies strlen
*/
bool isutf8(const void *data, size_t size) {
bool32 isutf8(const void *data, size_t size) {
long c;
const char *p, *e;
if (size == -1) size = data ? strlen(data) : 0;

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_STR_SLICE_H_
#define COSMOPOLITAN_LIBC_STR_SLICE_H_
#include "libc/stdbool.h"
#include "libc/str/str.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -18,7 +19,6 @@ COSMOPOLITAN_C_START_
int CompareSlices(const char *, size_t, const char *, size_t);
int CompareSlicesCase(const char *, size_t, const char *, size_t);
bool StartsWithIgnoreCase(const char *, const char *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool startswith(const char *s, const char *prefix) {
bool32 startswith(const char *s, const char *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool startswith16(const char16_t *s, const char16_t *prefix) {
bool32 startswith16(const char16_t *s, const char16_t *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -22,7 +22,7 @@
/**
* Checks if string starts with prefix, case insensitively.
*/
bool startswithi(const char *s, const char *prefix) {
bool32 startswithi(const char *s, const char *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;

View file

@ -178,11 +178,11 @@ uint64_t tpenc(uint32_t) pureconst;
char *chomp(char *) libcesque;
wchar_t *wchomp(wchar_t *) libcesque;
uint64_t __fnv(const void *, size_t) strlenesque;
bool startswith(const char *, const char *) strlenesque;
bool startswithi(const char *, const char *) strlenesque;
bool endswith(const char *, const char *) strlenesque;
bool istext(const void *, size_t) libcesque;
bool isutf8(const void *, size_t) libcesque;
bool32 startswith(const char *, const char *) strlenesque;
bool32 startswithi(const char *, const char *) strlenesque;
bool32 endswith(const char *, const char *) strlenesque;
bool32 istext(const void *, size_t) libcesque;
bool32 isutf8(const void *, size_t) libcesque;
char *strsignal_r(int, char[21]) returnsnonnull libcesque __wur;
int strerror_wr(int, uint32_t, char *, size_t)
dontthrow nocallback;
@ -207,12 +207,12 @@ char16_t *strcat16(char16_t *, const char16_t *) memcpyesque;
char16_t *strcpy16(char16_t *, const char16_t *) memcpyesque;
char16_t *strncat16(char16_t *, const char16_t *, size_t) memcpyesque;
char16_t *memset16(char16_t *, char16_t, size_t) memcpyesque;
bool startswith16(const char16_t *, const char16_t *) strlenesque;
bool endswith16(const char16_t *, const char16_t *) strlenesque;
bool32 startswith16(const char16_t *, const char16_t *) strlenesque;
bool32 endswith16(const char16_t *, const char16_t *) strlenesque;
axdx_t tprecode8to16(char16_t *, size_t, const char *);
axdx_t tprecode16to8(char *, size_t, const char16_t *);
bool wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
bool wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
bool32 wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
bool32 wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
char *__join_paths(char *, size_t, const char *, const char *) __wur;
#endif /* _COSMO_SOURCE */

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param suffix is also NUL-terminated
*/
bool wcsendswith(const wchar_t *s, const wchar_t *suffix) {
bool32 wcsendswith(const wchar_t *s, const wchar_t *suffix) {
size_t n, m;
n = wcslen(s);
m = wcslen(suffix);

View file

@ -24,7 +24,7 @@
* @param s is a NUL-terminated string
* @param prefix is also NUL-terminated
*/
bool _wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
bool32 wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
for (;;) {
if (!*prefix) return true;
if (!*s) return false;