diff options
Initial commitmain
Diffstat (limited to 'memory/wrap')
-rw-r--r-- | memory/wrap/free.c | 4 | ||||
-rw-r--r-- | memory/wrap/memory.h | 25 | ||||
-rw-r--r-- | memory/wrap/meson.build | 13 | ||||
-rw-r--r-- | memory/wrap/realloc.c | 4 | ||||
-rw-r--r-- | memory/wrap/strtod.c | 7 | ||||
-rw-r--r-- | memory/wrap/strtol.c | 8 | ||||
-rw-r--r-- | memory/wrap/strtoll.c | 8 | ||||
-rw-r--r-- | memory/wrap/strxfrm.c | 8 | ||||
-rw-r--r-- | memory/wrap/wcstod.c | 7 | ||||
-rw-r--r-- | memory/wrap/wcstol.c | 8 | ||||
-rw-r--r-- | memory/wrap/wcstoll.c | 8 | ||||
-rw-r--r-- | memory/wrap/wcsxfrm.c | 8 |
12 files changed, 108 insertions, 0 deletions
diff --git a/memory/wrap/free.c b/memory/wrap/free.c new file mode 100644 index 0000000..d65e3d8 --- /dev/null +++ b/memory/wrap/free.c @@ -0,0 +1,4 @@ +#include "memory.h" +#include <stdlib.h> + +void _free_wrap(void *buffer) { free(buffer); } diff --git a/memory/wrap/memory.h b/memory/wrap/memory.h new file mode 100644 index 0000000..55af1c6 --- /dev/null +++ b/memory/wrap/memory.h @@ -0,0 +1,25 @@ +#ifndef MEMORY_WRAP_H +#define MEMORY_WRAP_H + +#include <stddef.h> + +#if __STDC_HOSTED__ == 1 +extern void _free_wrap(void *ptr); +extern void *_realloc_wrap(void *ptr, size_t size); + +extern long _strtol_wrap(char const *restrict, char **restrict, int); +extern long long _strtoll_wrap(char const *restrict, char **restrict, int); +extern double _strtod_wrap(char const *restrict, char **restrict); +extern long _wcstol_wrap(wchar_t const *restrict, wchar_t **restrict, int); +extern long long _wcstoll_wrap(wchar_t const *restrict, wchar_t **restrict, + int); +extern double _wcstod_wrap(wchar_t const *restrict, wchar_t **restrict); + +extern size_t _strxfrm_wrap(char *restrict destination, + char const *restrict source, size_t count); +extern size_t _wcsxfrm_wrap(wchar_t *restrict destination, + wchar_t const *restrict source, size_t count); + +#endif + +#endif diff --git a/memory/wrap/meson.build b/memory/wrap/meson.build new file mode 100644 index 0000000..fc8a57f --- /dev/null +++ b/memory/wrap/meson.build @@ -0,0 +1,13 @@ +sources += files( +'memory.h', +'strtol.c', +'strtoll.c', +'strtod.c', +'strxfrm.c', +'wcsxfrm.c', +'wcstol.c', +'wcstoll.c', +'wcstod.c', +'free.c', +'realloc.c' +) diff --git a/memory/wrap/realloc.c b/memory/wrap/realloc.c new file mode 100644 index 0000000..5efb62e --- /dev/null +++ b/memory/wrap/realloc.c @@ -0,0 +1,4 @@ +#include "memory.h" +#include <stdlib.h> + +void *_realloc_wrap(void *buffer, size_t size) { return realloc(buffer, size); } diff --git a/memory/wrap/strtod.c b/memory/wrap/strtod.c new file mode 100644 index 0000000..19d4a0e --- /dev/null +++ b/memory/wrap/strtod.c @@ -0,0 +1,7 @@ +#include "memory.h" +#include <stdlib.h> + +double _strtod_wrap(char const *restrict string, char **restrict invalid) +{ + return strtod(string, invalid); +} diff --git a/memory/wrap/strtol.c b/memory/wrap/strtol.c new file mode 100644 index 0000000..e364f40 --- /dev/null +++ b/memory/wrap/strtol.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <stdlib.h> + +long _strtol_wrap(char const *restrict string, char **restrict invalid, + int base) +{ + return strtol(string, invalid, base); +} diff --git a/memory/wrap/strtoll.c b/memory/wrap/strtoll.c new file mode 100644 index 0000000..27bda06 --- /dev/null +++ b/memory/wrap/strtoll.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <stdlib.h> + +long long _strtoll_wrap(char const *restrict string, char **restrict invalid, + int base) +{ + return strtoll(string, invalid, base); +} diff --git a/memory/wrap/strxfrm.c b/memory/wrap/strxfrm.c new file mode 100644 index 0000000..87e9420 --- /dev/null +++ b/memory/wrap/strxfrm.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <string.h> + +size_t _strxfrm_wrap(char *restrict destination, char const *restrict source, + size_t count) +{ + return strxfrm(destination, source, count); +} diff --git a/memory/wrap/wcstod.c b/memory/wrap/wcstod.c new file mode 100644 index 0000000..037e210 --- /dev/null +++ b/memory/wrap/wcstod.c @@ -0,0 +1,7 @@ +#include "memory.h" +#include <wchar.h> + +double _wcstod_wrap(wchar_t const *restrict string, wchar_t **restrict invalid) +{ + return wcstod(string, invalid); +} diff --git a/memory/wrap/wcstol.c b/memory/wrap/wcstol.c new file mode 100644 index 0000000..7f0a569 --- /dev/null +++ b/memory/wrap/wcstol.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <wchar.h> + +long _wcstol_wrap(wchar_t const *restrict string, wchar_t **restrict invalid, + int base) +{ + return wcstol(string, invalid, base); +} diff --git a/memory/wrap/wcstoll.c b/memory/wrap/wcstoll.c new file mode 100644 index 0000000..e54272c --- /dev/null +++ b/memory/wrap/wcstoll.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <wchar.h> + +long long _wcstoll_wrap(wchar_t const *restrict string, + wchar_t **restrict invalid, int base) +{ + return wcstoll(string, invalid, base); +} diff --git a/memory/wrap/wcsxfrm.c b/memory/wrap/wcsxfrm.c new file mode 100644 index 0000000..4f39a31 --- /dev/null +++ b/memory/wrap/wcsxfrm.c @@ -0,0 +1,8 @@ +#include "memory.h" +#include <wchar.h> + +size_t _wcsxfrm_wrap(wchar_t *restrict destination, + wchar_t const *restrict source, size_t count) +{ + return wcsxfrm(destination, source, count); +} |