[postgis-devel] use of strnicmp

Paul Ramsey pramsey at cleverelephant.ca
Fri Sep 22 10:39:28 PDT 2017


There don't actually appear to be any calls to strnicmp in the .c files, so
that whole chunk of header seems to be out-of-date. Maybe our windows build
base moved in posix support to the point where it doesn't matter anymore.
That still leaves questions of why you'd have any regression issues once
you got build running though.

P.

On Fri, Sep 22, 2017 at 10:04 AM, Greg Troxel <gdt at lexort.com> wrote:

>
> Greg Troxel <gdt at lexort.com> writes:
>
> > Building 2.3.3 on NetBSD, I am running into an error about strnicmp.
> > There's a comment in the source about it:
> >
> >   /* if we are in Unix define stricmp to be strcasecmp and strnicmp to */
> >   /* be strncasecmp. I'm not sure if all Unices have these, but Linux */
> >   /* does. */
> >
> > In general, the right approach (in the Unix part of the world) is to
> > look at the POSIX standards, and strongly prefer those.  strcasecmp is
> > in POSIX, and dates from 4.4BSD, so it's been around a really long time
> > (25 years?).  I have no idea about sticmp, but it seems to be an MS
> > thing.
> >
> > http://pubs.opengroup.org/onlinepubs/9699919799/
> functions/strcasecmp.html
> >
> > I haven't figured out why the defines aren't working, but it seems like
> > the code should be based on HAVE_FOO, with some way to set those
> > semi-manually on Windows (assuming the windows build doesn't use
> > autoconf).
>
> The problem is that there are a bunch of ifdefs that define UNIX on a
> number of operating systems, and further define LINUX on systems that
> aren't Linux, but they don't cover everything.  This seems overly
> complicated and wrong; a LINUX ifdef should be used only for things
> where the POSIX approach doesn't work and some non-standard Linuxism has
> to be used.
>
> As I understand it, there is windows that probably doesn't use autoconf,
> and then a wide variety of almost-entirely POSIX systems that do.  So it
> seems like the right thing is to get rid of #ifdef UNIX and instead to
> use #ifndef WINDOWS, for the right value of windows.
>
> After removing the #ifdef UNIX around the code that defines stricmp to
> strcasecmp, raster builds, but some of the tests fail.
>
> I haven't looked at 2.4.0 in this regard yet.  I just noticed a failure
> of 2.3.3 as we prepare for the next pkgsrc branch.  It must have worked
> when I updated, but perhaps UNIX was defined in the environment for some
> reason and now isn't.
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20170922/3566f108/attachment.html>


More information about the postgis-devel mailing list