diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 16:53:55 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 16:53:55 -0800 |
commit | b4cb7c06f94e2e91b22b7d82efd7943a82331d86 (patch) | |
tree | 99fa7085855875efa7422ee58f322f8c94bda860 /include/base.h | |
parent | 07e77936d535e58b0aeb4f2a11400c1050556739 (diff) |
Chore: updated fs·walk to use new data structures
Completes the port to our standard library (up to malloc).
Diffstat (limited to 'include/base.h')
-rw-r--r-- | include/base.h | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/include/base.h b/include/base.h index 99cd40b..7c8afbb 100644 --- a/include/base.h +++ b/include/base.h @@ -6,30 +6,14 @@ #include <rt.h> #include <sys.h> -// TODO: remove dependency system headers -#include <assert.h> -/* remaining libc functions we depend upon */ +// TODO: remove dependency on malloc + +/* all libc functions we depend upon */ void *malloc(uintptr size); void *calloc(uintptr n, uintptr size); void *realloc(void *ptr, uintptr size); void free(void *ptr); -void abort(void); -#if 0 -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ctype.h> -#include <stdio.h> -#include <wchar.h> -#include <errno.h> -#include <pwd.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> - -typedef wchar_t wchar; -#endif -#include <sys/stat.h> +noreturn void abort(void); /* must be included first */ #include <base/memory.h> @@ -52,6 +36,13 @@ typedef wchar_t wchar; // ----------------------------------------------------------------------------- // variable arguments +noreturn void ·failassert(const char *, const char *, int, const char *); +#ifdef NDEBUG +# define assert(x) (void)0; +#else +# define assert(x) ((void)((x) || (·failassert(#x, __FILE__, __LINE__, __func__),0))) +#endif + /* from plan9 libc */ #define ERRMAX 128 /* max length of error string */ |