[PATCH:mkfontscale 2/2] Remove a couple of 'const' that aren't OK for the caller.

Alan Coopersmith alan.coopersmith at oracle.com
Thu Jun 6 22:32:26 PDT 2013


On 06/ 2/13 12:16 PM, Thomas Klausner wrote:
> ---
>   mkfontscale.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mkfontscale.c b/mkfontscale.c
> index 53c5303..15efaac 100644
> --- a/mkfontscale.c
> +++ b/mkfontscale.c
> @@ -60,7 +60,7 @@
>   #define QUOTE(x)	#x
>   #define STRINGIFY(x)	QUOTE(x)
>
> -static const char *encodings_array[] =
> +static char *encodings_array[] =
>       { "ascii-0",
>         "iso8859-1", "iso8859-2", "iso8859-3", "iso8859-4", "iso8859-5",
>         "iso8859-6", "iso8859-6.8", "iso8859-6.8x", "iso8859-6.16",
> @@ -79,7 +79,7 @@ static const char *encodings_array[] =
>         "gb2312.1980-0", "gb18030.2000-0", "gb18030.2000-1",
>         "ksc5601.1987-0", "ksc5601.1992-3"};
>
> -static const char *extra_encodings_array[] =
> +static char *extra_encodings_array[] =
>       { "iso10646-1", "adobe-fontspecific", "microsoft-symbol" };
>
>   static ListPtr encodings, extra_encodings;
>

I'm not sure what the best thing to do is here - removing the const just
brings back all the warnings that we're using a non-const char * for all
those string literals, but since we pass the array to

ListPtr makeList(char **a, int n, ListPtr old, int begin);

we get complaints about passing a const to a function wanting non-const.

I started looking at changing the List functions to all use const char *,
but the xlfd lists pass dynamically allocated values to those and use
deepDestroyList() to free them, so this code just expects some lists to
have constant strings and some not to and to use the same functions &
types for both, which is messy.

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


More information about the xorg-devel mailing list