[Mesa-dev] [PATCH] glsl: Correct string.h to strings.h
Kenneth Graunke
kenneth at whitecape.org
Wed Aug 27 11:50:36 PDT 2014
On Wednesday, August 27, 2014 01:00:08 PM Alexander von Gluck IV wrote:
> On , Kenneth Graunke wrote:
> > On Wednesday, August 27, 2014 11:35:06 AM Alexander von Gluck IV wrote:
> >> * IEEE Std 1003.1-2001 placed strcasecmp() in strings.h.
> >> * On a lot of platforms, strcasecmp is in strings.h and string.h
> >> * Technically strcasecmp should be only in strings.h
> >> * Haiku decided to stop providing strcasecmp in string.h as it
> >> is a crutch to code looking in the wrong place.
> >> ---
> >> src/glsl/glsl_parser.yy | 2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> >> index 2f30b85..33c2f20 100644
> >> --- a/src/glsl/glsl_parser.yy
> >> +++ b/src/glsl/glsl_parser.yy
> >> @@ -23,7 +23,7 @@
> >> */
> >> #include <stdio.h>
> >> #include <stdlib.h>
> >> -#include <string.h>
> >> +#include <strings.h>
> >> #include <assert.h>
> >>
> >> #include "ast.h"
> >>
> >
> > But it also uses strcmp(), which is definitely defined in string.h.
> > It sounds like we should include both.
>
> I agree... however I hear that windows doesn't do strings.h.
>
> Thinking maybe #include <string.h> and ifndef _MSC_VER #include
> <strings.h> ?
If Windows doesn't support strings.h, then that's probably the right thing to do. On Windows, strcasecmp comes from src/mesa/main/imports.h anyway.
> I confirmed that ISO C99 doesn't mention strcase* in string.h and IEEE
> std
> 1003.1-2001 shows strcase* only in strings.h
>
> Any operating systems including strcase* in strings.h is doing it for
> legacy
> compatibility for software pre-2001.
>
> Man page for strcasecmp also confirms it's in strings.h:
> http://linux.die.net/man/3/strcasecmp
>
> -- Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140827/08ae0778/attachment.sig>
More information about the mesa-dev
mailing list