mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
lib/util: fix const warnings
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
cc2bc23e46
commit
f03653e39a
@ -74,11 +74,14 @@ const char **parmlist_get_string_list(struct parmlist *ctx, const char *name,
|
||||
const char *separator)
|
||||
{
|
||||
struct parmlist_entry *p = parmlist_get(ctx, name);
|
||||
char **l;
|
||||
|
||||
if (p == NULL)
|
||||
if (p == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (const char **)str_list_make(ctx, p->value, separator);
|
||||
l = str_list_make(ctx, p->value, separator);
|
||||
return discard_const_p(const char *, l);
|
||||
}
|
||||
|
||||
static struct parmlist_entry *parmlist_get_add(struct parmlist *ctx, const char *name)
|
||||
|
@ -67,7 +67,8 @@ static void samba_tevent_debug(void *context,
|
||||
|
||||
void samba_tevent_set_debug(struct tevent_context *ev, const char *name)
|
||||
{
|
||||
tevent_set_debug(ev, samba_tevent_debug, name);
|
||||
void *p = discard_const(name);
|
||||
tevent_set_debug(ev, samba_tevent_debug, p);
|
||||
}
|
||||
|
||||
struct tevent_context *samba_tevent_context_init(TALLOC_CTX *mem_ctx)
|
||||
|
@ -204,13 +204,16 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
|
||||
|
||||
va_start(ap, argv0);
|
||||
while (1) {
|
||||
const char **l;
|
||||
char *arg = va_arg(ap, char *);
|
||||
if (arg == NULL) break;
|
||||
argv = discard_const_p(char *, str_list_add((const char **)argv, arg));
|
||||
if (!argv) {
|
||||
l = discard_const_p(const char *, argv);
|
||||
l = str_list_add(l, arg);
|
||||
if (l == NULL) {
|
||||
fprintf(stderr, "Out of memory in child\n");
|
||||
_exit(255);
|
||||
}
|
||||
argv = discard_const_p(char *, l);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
|
@ -519,6 +519,6 @@ _PUBLIC_ const char **str_list_copy_const(TALLOC_CTX *mem_ctx,
|
||||
*/
|
||||
_PUBLIC_ const char **const_str_list(char **list)
|
||||
{
|
||||
return (const char **)list;
|
||||
return discard_const_p(const char *, list);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user