On 07.02.2016 08:55, Mauro Rossi wrote: > From 8030a6cd9d7bb3320fca94038f1969db56223598 Mon Sep 17 00:00:00 2001 > From: Mauro Rossi <issor.or...@gmail.com <mailto:issor.or...@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.veli...@gmail.com > <mailto:emil.l.veli...@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 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev