summaryrefslogtreecommitdiff
path: root/minion/src/util.hpp
blob: d6f7f1c46fe087a1ef6a14fa372d9dc218e9b981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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