summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-09-24 15:52:58 -0700
committerJeremy Allison <jra@samba.org>2009-09-24 15:52:58 -0700
commitd1aa7d479697a8fcc5d8237271c473a1b831949b (patch)
tree15a56f6d487bea5c158124378c72586a1f23385f /lib/util
parent536c4dd2d69f9a35547c0ce77b47c4f0b03aa5ac (diff)
downloadsamba-d1aa7d479697a8fcc5d8237271c473a1b831949b.tar.gz
samba-d1aa7d479697a8fcc5d8237271c473a1b831949b.tar.bz2
samba-d1aa7d479697a8fcc5d8237271c473a1b831949b.zip
Remove the const from the str_list_XXX functions that
allocate both list and containing strings. This fixes problems that people have tried to cast away and are not needed. Jeremy.
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/util.h10
-rw-r--r--lib/util/util_strlist.c38
2 files changed, 24 insertions, 24 deletions
diff --git a/lib/util/util.h b/lib/util/util.h
index 385a3ae07a..c766e3dce7 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -407,12 +407,12 @@ _PUBLIC_ bool strequal(const char *s1, const char *s2);
/**
build an empty (only NULL terminated) list of strings (for expansion with str_list_add() etc)
*/
-_PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx);
+_PUBLIC_ char **str_list_make_empty(TALLOC_CTX *mem_ctx);
/**
place the only element 'entry' into a new, NULL terminated string list
*/
-_PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx,
+_PUBLIC_ char **str_list_make_single(TALLOC_CTX *mem_ctx,
const char *entry);
/**
@@ -420,7 +420,7 @@ _PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx,
separator list. The separator list must contain characters less than
or equal to 0x2f for this to work correctly on multi-byte strings
*/
-_PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string,
+_PUBLIC_ char **str_list_make(TALLOC_CTX *mem_ctx, const char *string,
const char *sep);
/**
@@ -428,7 +428,7 @@ _PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string,
* Entries are seperated by spaces and can be enclosed by quotes.
* Does NOT support escaping
*/
-_PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
+_PUBLIC_ char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
/**
* join a list back to one string
@@ -447,7 +447,7 @@ _PUBLIC_ size_t str_list_length(const char * const *list);
/**
copy a string list
*/
-_PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list);
+_PUBLIC_ char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list);
/**
Return true if all the elements of the list match exactly.
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
index b4b991f3db..1331fee6a7 100644
--- a/lib/util/util_strlist.c
+++ b/lib/util/util_strlist.c
@@ -31,11 +31,11 @@
/**
build an empty (only NULL terminated) list of strings (for expansion with str_list_add() etc)
*/
-_PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx)
+_PUBLIC_ char **str_list_make_empty(TALLOC_CTX *mem_ctx)
{
- const char **ret = NULL;
+ char **ret = NULL;
- ret = talloc_array(mem_ctx, const char *, 1);
+ ret = talloc_array(mem_ctx, char *, 1);
if (ret == NULL) {
return NULL;
}
@@ -48,11 +48,11 @@ _PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx)
/**
place the only element 'entry' into a new, NULL terminated string list
*/
-_PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entry)
+_PUBLIC_ char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entry)
{
- const char **ret = NULL;
+ char **ret = NULL;
- ret = talloc_array(mem_ctx, const char *, 2);
+ ret = talloc_array(mem_ctx, char *, 2);
if (ret == NULL) {
return NULL;
}
@@ -72,30 +72,30 @@ _PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entr
separator list. The separator list must contain characters less than
or equal to 0x2f for this to work correctly on multi-byte strings
*/
-_PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
+_PUBLIC_ char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
{
int num_elements = 0;
- const char **ret = NULL;
+ char **ret = NULL;
if (sep == NULL) {
sep = LIST_SEP;
}
- ret = talloc_array(mem_ctx, const char *, 1);
+ ret = talloc_array(mem_ctx, char *, 1);
if (ret == NULL) {
return NULL;
}
while (string && *string) {
size_t len = strcspn(string, sep);
- const char **ret2;
+ char **ret2;
if (len == 0) {
string += strspn(string, sep);
continue;
}
- ret2 = talloc_realloc(mem_ctx, ret, const char *,
+ ret2 = talloc_realloc(mem_ctx, ret, char *,
num_elements+2);
if (ret2 == NULL) {
talloc_free(ret);
@@ -123,12 +123,12 @@ _PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, con
* Entries are seperated by spaces and can be enclosed by quotes.
* Does NOT support escaping
*/
-_PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
+_PUBLIC_ char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
{
int num_elements = 0;
- const char **ret = NULL;
+ char **ret = NULL;
- ret = talloc_array(mem_ctx, const char *, 1);
+ ret = talloc_array(mem_ctx, char *, 1);
if (ret == NULL) {
return NULL;
}
@@ -139,7 +139,7 @@ _PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *strin
while (string && *string) {
size_t len = strcspn(string, sep);
char *element;
- const char **ret2;
+ char **ret2;
if (len == 0) {
string += strspn(string, sep);
@@ -161,7 +161,7 @@ _PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *strin
return NULL;
}
- ret2 = talloc_realloc(mem_ctx, ret, const char *, num_elements+2);
+ ret2 = talloc_realloc(mem_ctx, ret, char *, num_elements+2);
if (ret2 == NULL) {
talloc_free(ret);
return NULL;
@@ -238,15 +238,15 @@ _PUBLIC_ size_t str_list_length(const char * const *list)
/**
copy a string list
*/
-_PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list)
+_PUBLIC_ char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list)
{
int i;
- const char **ret;
+ char **ret;
if (list == NULL)
return NULL;
- ret = talloc_array(mem_ctx, const char *, str_list_length(list)+1);
+ ret = talloc_array(mem_ctx, char *, str_list_length(list)+1);
if (ret == NULL)
return NULL;