[Mesa-dev] [PATCH 2/5] android: radeonsi: fix building error in si_shader.c

Michel Dänzer michel at daenzer.net
Mon Feb 8 07:12:40 UTC 2016


On 07.02.2016 08:55, Mauro Rossi wrote:
> From 8030a6cd9d7bb3320fca94038f1969db56223598 Mon Sep 17 00:00:00 2001
> From: Mauro Rossi <issor.oruam at gmail.com <mailto:issor.oruam at gmail.com>>
> Date: Sat, 6 Feb 2016 23:52:36 +0100
> Subject: [PATCH 1/2] android: add support for strchrnul
> 
> Android Bionic has no strchrnul in string functions,
> radeonsi uses strchrnul, so we need an implementation.
> 
> strchrnul.h is added in top mesa include path.
> ---
>  include/strchrnul.h | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>  create mode 100644 include/strchrnul.h
> 
> diff --git a/include/strchrnul.h b/include/strchrnul.h
> new file mode 100644
> index 0000000..83477e2
> --- /dev/null
> +++ b/include/strchrnul.h
> @@ -0,0 +1,40 @@
> +/**************************************************************************
> + *
> + * Copyright (C) 2014 Emil Velikov <emil.l.velikov at gmail.com
> <mailto:emil.l.velikov at gmail.com>>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included
> + * in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> +
> **************************************************************************/
> +
> +#ifndef _STRCHRNUL_H_
> +#define _STRCHRNUL_H_
> +
> +char *
> +strchrnul(const char *s, int c)
> +{
> +    char * result = strchr(s, c);
> +
> +    if (result == NULL) {
> +        result = s + strlen(s);
> +    }
> +
> +    return result;
> +}
> +
> +#endif /* _STRCHRNUL_H_ */

Apart from my review of patch 2, this header should

#include <string.h>

so that it also works on platforms which do provide strchrnul.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list