Add base headers

This commit is contained in:
2022-06-02 14:20:55 +03:00
parent 147bda0a2b
commit 3c4ff8587e
8 changed files with 425 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <string.h>
#include "../__attributes.h"
#ifndef LIBCDSB_EXTRA_CSTRING_H
#define LIBCDSB_EXTRA_CSTRING_H
extern size_t libcdsb_strlen (const char* s) LIBCDSB_pure__ LIBCDSB_nn1__;
extern size_t libcdsb_strasciilen(const char* s) LIBCDSB_pure__ LIBCDSB_nn1__;
extern char* libcdsb_strdup (const char* s) LIBCDSB_nt__ LIBCDSB_wur__ LIBCDSB_nn1__;
extern char* libcdsb_strndup(const char* s, size_t n) LIBCDSB_nt__ LIBCDSB_wur__ LIBCDSB_nn1__;
extern void* libcdsb_memndup(const void* m, size_t n) LIBCDSB_nt__ LIBCDSB_wur__ LIBCDSB_nn1__;
#define strlen libcdsb_strlen
#define strasciilen libcdsb_strasciilen
#define strdup libcdsb_strdup
#define strndup libcdsb_strndup
#define memndup libcdsb_memndup
#endif /* LIBCDSB_EXTRA_CSTRING_H */
+20
View File
@@ -0,0 +1,20 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <stddef.h>
#include "../__attributes.h"
#ifndef LIBCDSB_EXTRA_MEMORY_H
#define LIBCDSB_EXTRA_MEMORY_H
extern void* libcdsb_aalloc (size_t a, size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
extern void* libcdsb_malloc (size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
extern void* libcdsb_calloc (size_t n, size_t c) LIBCDSB_nt__ LIBCDSB_wur__;
extern void* libcdsb_realloc(void *p, size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
#define aligned_alloc libcdsb_aalloc
#define malloc libcdsb_malloc
#define calloc libcdsb_calloc
#define realloc libcdsb_realloc
#endif /* LIBCDSB_EXTRA_MEMORY_H */