[Mesa-dev] [PATCH] ac/debug: use util_strchrnul() to fix android build error
Chih-Wei Huang
cwhuang at android-x86.org
Fri Aug 25 06:16:02 UTC 2017
2017-08-25 5:52 GMT+08:00 Mauro Rossi <issor.oruam at gmail.com>:
> Similar to e09d04cd56 "radeonsi: use util_strchrnul() to fix android build error"
>
> Android Bionic does not support strchrnul() string function,
This is not entirely true.
Bionic has strchrnul() since Android 7.0.
But I think it's OK to merge this one.
We can address Android 7.0 in another patch.
> gallium auxiliary util/u_string.h provides util_strchrnul()
>
> This change avoids the following warning and error:
>
> external/mesa/src/amd/common/ac_debug.c:501:15: warning: implicit declaration of function 'strchrnul' is invalid in C99
> char *end = strchrnul(out, '\n');
> ^
> external/mesa/src/amd/common/ac_debug.c:501:9: error: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int'
> char *end = strchrnul(out, '\n');
> ^ ~~~~~~~~~~~~~~~~~~~~
> 1 warning and 1 error generated.
>
> Fixes: c2c3912410 "ac/debug: annotate IB dumps with the raw values"
> ---
> src/amd/common/ac_debug.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c
> index 2af83a146c..3daa556f5d 100644
> --- a/src/amd/common/ac_debug.c
> +++ b/src/amd/common/ac_debug.c
> @@ -39,6 +39,7 @@
> #include "sid_tables.h"
> #include "util/u_math.h"
> #include "util/u_memory.h"
> +#include "util/u_string.h"
>
> /* Parsed IBs are difficult to read without colors. Use "less -R file" to
> * read them, or use "aha -b -f file" to convert them to html.
> @@ -498,7 +499,7 @@ static void format_ib_output(FILE *f, char *out)
> if (indent)
> print_spaces(f, indent);
>
> - char *end = strchrnul(out, '\n');
> + char *end = util_strchrnul(out, '\n');
> fwrite(out, end - out, 1, f);
> fputc('\n', f); /* always end with a new line */
> if (!*end)
> --
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
More information about the mesa-dev
mailing list