Re: [PATCH v2 1/6] string_list: add function string_list_append_nodup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Haggerty <mhagger@xxxxxxxxxxxx> writes:

> diff --git a/string-list.c b/string-list.c
> index d9810ab..5594b7d 100644
> --- a/string-list.c
> +++ b/string-list.c
> @@ -148,13 +148,23 @@ void print_string_list(const struct string_list *p, const char *text)
>  		printf("%s:%p\n", p->items[i].string, p->items[i].util);
>  }
>  
> -struct string_list_item *string_list_append(struct string_list *list, const char *string)
> +struct string_list_item *string_list_append_nodup(struct string_list *list,
> +						  char *string)
>  {
> +	struct string_list_item *retval;
>  	ALLOC_GROW(list->items, list->nr + 1, list->alloc);
> -	list->items[list->nr].string =
> -		list->strdup_strings ? xstrdup(string) : (char *)string;
> -	list->items[list->nr].util = NULL;
> -	return list->items + list->nr++;
> +	retval = &list->items[list->nr++];
> +	retval->string = (char *)string;

Do you still need this cast, now the function takes non-const "char *string"?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]