5 #include <ctu_base_api.h>
CT_NODISCARD STA_WRITES(size) void *dst
#define CT_PUREFN
mark a function as pure, always returns the same value for the same arguments
#define CT_NODISCARD
mark a function as returning a value that must be used
#define STA_READS(size)
annotate a parameter as reading expr elements
#define CT_CONSTFN
mark a function as const, has no side effects and always returns the same value for the same argument...
#define IN_STRING
annotate a parameter as being a null terminated string
#define CT_NOALIAS
mark a function as only modifying pointers passed to it the same as CT_CONSTFN but allowed to modify/...
CT_NODISCARD CT_PUREFN CT_BASE_API int ctu_strncmp(const char *lhs, const char *rhs, size_t length)
compare two strings equivalent to strncmp but with safety checks
CT_NODISCARD CT_CONSTFN CT_BASE_API ctu_hash_t ctu_ptrhash(const void *ptr)
hash a pointer value
CT_NODISCARD CT_PUREFN CT_BASE_API int ctu_strcmp(const char *lhs, const char *rhs)
compare two strings equivalent to strcmp but with safety checks
CT_BASE_API char * ctu_strcpy(STA_WRITES(size) char *dst, const char *src, size_t size)
copy a string equivalent to strcpy but with safety checks
CT_CONSTFN CT_BASE_API text_t text_make(STA_READS(length) char *text, size_t length)
create a new owning text array text must be a valid string at least length bytes long
CT_BASE_API void * ctu_memmove(STA_WRITES(size) void *dst, STA_READS(size) const void *src, size_t size)
move memory from one location to another equivalent to memmove but with safety checks
CT_NODISCARD CT_PUREFN CT_BASE_API ctu_hash_t text_hash(text_view_t text)
hash a string with a provided length
CT_NOALIAS CT_BASE_API void * ctu_memcpy(STA_WRITES(size) void *CT_RESTRICT dst, STA_READS(size) const void *CT_RESTRICT src, size_t size)
copy memory from one location to another equivalent to memcpy but with safety checks
CT_NODISCARD CT_PUREFN CT_BASE_API bool ctu_string_empty(const char *str)
check if a string is empty equivalent to strlen(str) == 0
CT_BEGIN_API CT_NODISCARD CT_PUREFN CT_BASE_API bool is_path_special(const char *path)
check if a path is special special paths are paths such as "." and ".." that are not valid for most o...
CT_NODISCARD CT_PUREFN CT_BASE_API size_t ctu_strlen(const char *str)
get the length of a string not including the null terminator equivalent to strlen but with safety che...
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isalpha(int c)
check if a character is a letter
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isdigit(int c)
check if a character is a digit
CT_NODISCARD CT_PUREFN CT_BASE_API char * ctu_strstr(const char *haystack, const char *needle)
find a substring in a string equivalent to strstr but with safety checks
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isalnum(int c)
check if a character is alphanumeric
CT_NODISCARD CT_PUREFN CT_BASE_API bool str_equal(const char *lhs, const char *rhs)
compare strings equality
CT_CONSTFN CT_BASE_API text_view_t text_view_make(STA_READS(length) const char *text, size_t length)
create a new non-owning text array text must be at least length bytes long
CT_PUREFN CT_BASE_API bool text_equal(text_view_t lhs, text_view_t rhs)
check if two text objects are equal
CT_NODISCARD CT_PUREFN CT_BASE_API ctu_hash_t str_hash(const char *str)
hash a string
CT_PUREFN CT_BASE_API text_view_t text_view_from(const char *text)
create a new non-owning text array this is a shortcut for
CT_NOALIAS CT_BASE_API void ctu_memset(STA_WRITES(size) void *dst, int value, size_t size)
set memory to a value equivalent to memset but with safety checks
CT_PUREFN CT_BASE_API text_t text_from(char *text)
create a new owning text array this is a shortcut for
a non-owning view of text