Re: [PATCH 17/28] attr: expose validity check for attribute names

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

 



On 10/10, Stefan Beller wrote:
> From: Junio C Hamano <gitster@xxxxxxxxx>
> -static int invalid_attr_name(const char *name, int namelen)
> +int attr_name_valid(const char *name, size_t namelen)
>  {
>  	/*
>  	 * Attribute name cannot begin with '-' and must consist of
>  	 * characters from [-A-Za-z0-9_.].
>  	 */
>  	if (namelen <= 0 || *name == '-')
> -		return -1;
> +		return 0;
>  	while (namelen--) {
>  		char ch = *name++;
>  		if (! (ch == '-' || ch == '.' || ch == '_' ||
>  		       ('0' <= ch && ch <= '9') ||
>  		       ('a' <= ch && ch <= 'z') ||
>  		       ('A' <= ch && ch <= 'Z')) )
> -			return -1;
> +			return 0;
>  	}
> -	return 0;
> +	return -1;
> +}

Whats the reason behind returning -1 for a valid attr name vs 1?

-- 
Brandon Williams



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