aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_str_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_str_types.h')
-rw-r--r--src/microhttpd/mhd_str_types.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_str_types.h b/src/microhttpd/mhd_str_types.h
new file mode 100644
index 00000000..c846ebef
--- /dev/null
+++ b/src/microhttpd/mhd_str_types.h
@@ -0,0 +1,68 @@
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2015-2022 Karlson2k (Evgeny Grin)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20/**
21 * @file microhttpd/mhd_str_types.h
22 * @brief Header for string manipulating helpers types
23 * @author Karlson2k (Evgeny Grin)
24 */
25
26#ifndef MHD_STR_TYPES_H
27#define MHD_STR_TYPES_H 1
28
29#ifndef MHD_STATICSTR_LEN_
30/**
31 * Determine length of static string / macro strings at compile time.
32 */
33#define MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1)
34#endif /* ! MHD_STATICSTR_LEN_ */
35
36/**
37 * Constant string with length
38 */
39struct _MHD_cstr_w_len
40{
41 const char *const str;
42 const size_t len;
43};
44
45/**
46 * String with length
47 */
48struct _MHD_str_w_len
49{
50 const char *str;
51 size_t len;
52};
53
54/**
55 * Modifiable string with length
56 */
57struct _MHD_mstr_w_len
58{
59 char *str;
60 size_t len;
61};
62
63/**
64 * Static string initialiser for struct _MHD_str_w_len
65 */
66#define _MHD_S_STR_W_LEN(str) { str, MHD_STATICSTR_LEN_(str) }
67
68#endif /* MHD_STR_TYPES_H */