2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 2005
5 Copyright (C) Jelmer Vernooij 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "system/locale.h"
23 #include "lib/util/tsort.h"
29 * @brief String list manipulation v3
33 * Needed for making an "unconst" list "const"
35 _PUBLIC_
const char **const_str_list(char **list
)
37 return discard_const_p(const char *, list
);
41 * str_list_make, v3 version. The v4 version does not
42 * look at quoted strings with embedded blanks, so
43 * do NOT merge this function please!
45 #define S_LIST_ABS 16 /* List Allocation Block Size */
47 char **str_list_make_v3(TALLOC_CTX
*mem_ctx
, const char *string
,
55 if (!string
|| !*string
)
58 list
= talloc_array(mem_ctx
, char *, S_LIST_ABS
+1);
64 s
= talloc_strdup(list
, string
);
66 DEBUG(0,("str_list_make: Unable to allocate memory\n"));
72 * DON'T REPLACE THIS BY "LIST_SEP". The common version of
73 * LIST_SEP does not contain the ;, which used to be accepted
74 * by Samba 4.0 before param merges. It would be the far
75 * better solution to split the _v3 version again to source3/
76 * where it belongs, see the _v3 in its name.
78 * Unfortunately it is referenced in /lib/param/loadparm.c,
79 * which depends on the version that the AD-DC mandates,
80 * namely without the ; as part of the list separator. I am
81 * missing the waf fu to properly work around the wrong
82 * include paths here for this defect.
91 while (next_token_talloc(list
, &str
, &tok
, sep
)) {
98 tmp
= talloc_realloc(mem_ctx
, list
, char *,
101 DEBUG(0,("str_list_make: "
102 "Unable to allocate memory\n"));
109 memset (&list
[num
], 0,
110 ((sizeof(char*)) * (S_LIST_ABS
+1)));
123 const char **str_list_make_v3_const(TALLOC_CTX
*mem_ctx
,
127 return const_str_list(str_list_make_v3(mem_ctx
, string
, sep
));