Re: [PATCH v2 3/7] string-list: unify string_list_split* functions

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

 



On Thu, Jul 31, 2025 at 03:46:02PM -0700, Junio C Hamano wrote:

[snip]

> +/*
> + * append a substring [p..end] to list; return number of things it
> + * appended to the list.
> + */

In the following function, we would always return 1. So, I guess in the
following commits, there would be a case where we won't append the
string. And it is, in [PATCH v2 6/7], we would simply skip and return 0.

And I have a design question, should we make "append_one" pure? It would
simply attend a string where start is `p` and end is `end`? Let's see in
the later patches whether we could do this.

> +static int append_one(struct string_list *list,
> +		      const char *p, const char *end,
> +		      int in_place)
> +{
> +	if (!end)
> +		end = p + strlen(p);
> +
> +	if (in_place) {
> +		*((char *)end) = '\0';
> +		string_list_append(list, p);
> +	} else {
> +		string_list_append_nodup(list, xmemdupz(p, end - p));
> +	}
> +	return 1;

Thanks,
Jialuo




[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]

  Powered by Linux