Re: [PATCH v2 2/7] string-list: align string_list_split() with its _in_place() counterpart

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

 



On Thu, Jul 31, 2025 at 03:46:01PM -0700, Junio C Hamano wrote:
> diff --git a/setup.c b/setup.c
> index 6f52dab64c..b9f5eb8b51 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -1460,8 +1460,9 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
>  
>  	if (env_ceiling_dirs) {
>  		int empty_entry_found = 0;
> +		static const char path_sep[] = { PATH_SEP, '\0' };
>  

I am a little confused why we need to use `static`? Would this function
be called many times?

And I have a design question: by using "PATH_SEP", we need to convert
this character to be string. Should we create a new variable named
"PATH_SEP_STR" or whatever to do that?

> -		string_list_split(&ceiling_dirs, env_ceiling_dirs, PATH_SEP, -1);
> +		string_list_split(&ceiling_dirs, env_ceiling_dirs, path_sep, -1);
>  		filter_string_list(&ceiling_dirs, 0,
>  				   canonicalize_ceiling_entry, &empty_entry_found);
>  		ceil_offset = longest_ancestor_length(dir->buf, &ceiling_dirs);

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