diff options
author | vnugent <public@vaughnnugent.com> | 2024-04-25 17:45:42 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-04-25 17:45:42 -0400 |
commit | 6ff8bb11774c51fd341b7699a3938fd894995fbf (patch) | |
tree | 823ef4f5397e7ed96a5198a83d0c3b3145b3d127 /include/nc-util.h | |
parent | 7cb7a93de4f6f5e741bc5129e3d928e44f050930 (diff) |
refactor: Finish support and testing for mbedtls
Diffstat (limited to 'include/nc-util.h')
-rw-r--r-- | include/nc-util.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/nc-util.h b/include/nc-util.h index 23399e8..6a0e149 100644 --- a/include/nc-util.h +++ b/include/nc-util.h @@ -21,8 +21,8 @@ #pragma once -#ifndef NC_UTIL_H -#define NC_UTIL_H +#ifndef _NC_UTIL_H +#define _NC_UTIL_H #include "platform.h" @@ -62,6 +62,12 @@ #include <stdint.h> +#if SIZE_MAX < UINT32_MAX + #define _sizet_check(x) if(x > SIZE_MAX) return CSTATUS_FAIL; +#else + #define _sizet_check(x) +#endif + typedef struct memory_span_struct { uint8_t* data; @@ -74,16 +80,16 @@ typedef struct read_only_memory_span_struct uint32_t size; } cspan_t; -_nc_fn_inline void ncSpanInitC(cspan_t* span, const uint8_t* data, uint32_t size) +static _nc_fn_inline void ncSpanInitC(cspan_t* span, const uint8_t* data, uint32_t size) { span->data = data; span->size = size; } -_nc_fn_inline void ncSpanInit(span_t* span, uint8_t* data, uint32_t size) +static _nc_fn_inline void ncSpanInit(span_t* span, uint8_t* data, uint32_t size) { span->data = data; span->size = size; } -#endif /* NC_UTIL_H */
\ No newline at end of file +#endif /* !_NC_UTIL_H */
\ No newline at end of file |