diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-08 18:40:14 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-08 18:41:25 +0200 |
commit | 3a11866cb6a8fd46d86cb6e04dc1022344ea8d45 (patch) | |
tree | 1cd2b3739e8fc53cecc1b68da9ad989233773f4f /src/util.hpp | |
parent | 6546ff00988635608c0b3d5e53bb7387e680478c (diff) |
feat: add connecting to wifi
Diffstat (limited to 'src/util.hpp')
-rw-r--r-- | src/util.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/util.hpp b/src/util.hpp new file mode 100644 index 0000000..d6f7f1c --- /dev/null +++ b/src/util.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +namespace util +{ + +template <typename Type> +Type *malloc(size_t size) noexcept +{ + return static_cast<Type *>(::malloc(size)); +} + +bool str_ends_with(const char *str, const char *other_str) noexcept; + +/** + * Extracts a portion of a string. + * + * @param str The target string. + * @param end A pointer to a place inside the target string. + * @param dest Output buffer. + */ +void substr(const char *str, const char *end, char *dest) noexcept; + +} // namespace util |