[PATCH libXau] Constify XauGetBestAuthByAddr type_names argument

Alan Coopersmith alan.coopersmith at oracle.com
Wed Feb 26 14:15:25 PST 2014


Sorry, but char ** and const char ** are not compatible in C, and
trying to make changes like this is pure, unmitigated pain requiring
changing all callers in lockstep.

	-alan-

On 02/24/14 03:27 PM, Ran Benita wrote:
> The type names are merely accessed, not changed. So make it const to
> avoid warnings in other projects (like libxcb) which pass in a static
> table of string literals.
>
> Signed-off-by: Ran Benita <ran234 at gmail.com>
> ---
>   AuGetBest.c         | 2 +-
>   include/X11/Xauth.h | 2 +-
>   man/Xau.man         | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/AuGetBest.c b/AuGetBest.c
> index 5556559..0d59f85 100644
> --- a/AuGetBest.c
> +++ b/AuGetBest.c
> @@ -57,7 +57,7 @@ XauGetBestAuthByAddr (
>   #endif
>       _Xconst char*	number,
>       int			types_length,
> -    char**		types,
> +    _Xconst char**	types,
>       _Xconst int*	type_lengths)
>   {
>       FILE    *auth_file;
> diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h
> index a707bed..e0c4f28 100644
> --- a/include/X11/Xauth.h
> +++ b/include/X11/Xauth.h
> @@ -128,7 +128,7 @@ unsigned short	/* number_length */,
>   #endif
>   _Xconst char*	/* number */,
>   int		/* types_length */,
> -char**		/* type_names */,
> +_Xconst char**	/* type_names */,
>   _Xconst int*	/* type_lengths */
>   );
>
> diff --git a/man/Xau.man b/man/Xau.man
> index d1b6603..aa69b0d 100644
> --- a/man/Xau.man
> +++ b/man/Xau.man
> @@ -59,7 +59,7 @@ Xauth *XauGetAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short
>   Xauth *XauGetBestAuthByAddr (unsigned short \fIfamily\fP\^, unsigned short
>   \fIaddress_length\fP\^, const char *\fIaddress\fP\^, unsigned short
>   \fInumber_length\fP\^, const char *\fInumber\fP\^, int \fItypes_length\fP\^,
> -char **\fItypes\fR\^, const int *\fItype_lengths\fR\^);
> +const char **\fItypes\fR\^, const int *\fItype_lengths\fR\^);
>   .HP
>   int XauLockAuth (const char *\fIfile_name\fP\^, int \fIretries\fP\^, int
>   \fItimeout\fP\^, long \fIdead\fP\^);
>


-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list