[PATCH 4/7] Revert "os: xstrtokenize takes and returns const char * now"

Hans de Goede hdegoede at redhat.com
Thu Jan 30 00:44:23 PST 2014


Hi,

On 01/30/2014 12:51 AM, Peter Hutterer wrote:
> This reverts commit d0339a5c66846c9f14e3b584e34688520a0916ab.
> 
> seriously, what the fuck? Are we making xstrdup() return a const char now too?
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Looks good:

Reviewed By: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans

> ---
>  include/misc.h | 2 +-
>  os/utils.c     | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/misc.h b/include/misc.h
> index 165d42e..17de710 100644
> --- a/include/misc.h
> +++ b/include/misc.h
> @@ -246,7 +246,7 @@ padding_for_int32(const int bytes)
>  }
>  
>  
> -extern const char **xstrtokenize(const char *str, const char *separators);
> +extern char **xstrtokenize(const char *str, const char *separators);
>  extern void FormatInt64(int64_t num, char *string);
>  extern void FormatUInt64(uint64_t num, char *string);
>  extern void FormatUInt64Hex(uint64_t num, char *string);
> diff --git a/os/utils.c b/os/utils.c
> index dc18a67..497779b 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -1973,10 +1973,10 @@ CheckUserAuthorization(void)
>   * Tokenize a string into a NULL terminated array of strings. Always returns
>   * an allocated array unless an error occurs.
>   */
> -const char **
> +char **
>  xstrtokenize(const char *str, const char *separators)
>  {
> -    const char **list, **nlist;
> +    char **list, **nlist;
>      char *tok, *tmp;
>      unsigned num = 0, n;
>  
> @@ -2004,7 +2004,7 @@ xstrtokenize(const char *str, const char *separators)
>   error:
>      free(tmp);
>      for (n = 0; n < num; n++)
> -        free((void *) list[n]);
> +        free(list[n]);
>      free(list);
>      return NULL;
>  }
> 


More information about the xorg-devel mailing list