src/util/string.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef UTIL_STRING_H
7#define UTIL_STRING_H
8
9#include "util/common.h"
10
11#ifndef strndup
12// This is sometimes a macro
13char* strndup(const char* start, size_t len);
14#endif
15
16#ifndef strdup
17char* strdup(const char* str);
18#endif
19
20char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len);
21
22int utfcmp(const uint16_t* utf16, const char* utf8, size_t utf16Length, size_t utf8Length);
23char* utf16to8(const uint16_t* utf16, size_t length);
24
25int hexDigit(char digit);
26const char* hex32(const char* line, uint32_t* out);
27const char* hex16(const char* line, uint16_t* out);
28
29#endif