Re: [PATCH]: tree-walk.h: Warning fix

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

 



"Luiz Fernando N. Capitulino" <lcapitulino@xxxxxxxxxxxxxxx>
writes:

> diff --git a/tree-walk.h b/tree-walk.h
> index ee747ab..625198f 100644
> --- a/tree-walk.h
> +++ b/tree-walk.h
> @@ -22,7 +22,7 @@ static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, co
>  
>  static inline int tree_entry_len(const char *name, const unsigned char *sha1)
>  {
> -	return (char *)sha1 - (char *)name - 1;
> +	return (const char *)sha1 - (const char *)name - 1;
>  }
>  
>  void update_tree_entry(struct tree_desc *);

Grumble.  Incoming "name" is already (const char*), isn't it?
I'd cast only the sha1 side and apply.

However, I think -Wcast-qual is a pretty useless option.  

The nastiest one, if you care, is exec_cmd.c::execv_git_cmd()
where we never muck with "const char **argv" ourselves, but we
have to call execve(), which takes (char**) as its second
parameter.  We cast away constness for that call; otherwise you
would then get prototype mismatch.

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

  Powered by Linux