Cthulhu  0.2.10
Cthulhu compiler collection
util.h File Reference
#include <ctu_base_api.h>
#include "core/analyze.h"
#include "core/compiler.h"
#include "core/text.h"
#include "core/types.h"
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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 operations More...
 
CT_NODISCARD CT_CONSTFN CT_BASE_API ctu_hash_t ctu_ptrhash (const void *ptr)
 hash a pointer value More...
 
CT_NODISCARD CT_PUREFN CT_BASE_API ctu_hash_t str_hash (const char *str)
 hash a string More...
 
CT_NODISCARD CT_PUREFN CT_BASE_API ctu_hash_t text_hash (text_view_t text)
 hash a string with a provided length More...
 
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isalpha (int c)
 check if a character is a letter More...
 
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isdigit (int c)
 check if a character is a digit More...
 
CT_NODISCARD CT_CONSTFN CT_BASE_API bool ctu_isalnum (int c)
 check if a character is alphanumeric More...
 
CT_NODISCARD CT_PUREFN CT_BASE_API bool str_equal (const char *lhs, const char *rhs)
 compare strings equality More...
 
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 More...
 
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 checks More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
CT_PUREFN CT_BASE_API text_t text_from (char *text)
 create a new owning text array this is a shortcut for More...
 
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 More...
 
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 More...
 
CT_PUREFN CT_BASE_API bool text_equal (text_view_t lhs, text_view_t rhs)
 check if two text objects are equal More...