Thread: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Michael Meskes
Date:
Windows doesn't have strtok_r, so let's use strtok_s instead.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e3155c97b0fa6d73aa9128cf0e56e8a776f5d355

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c |    4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)


Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Andrew Dunstan
Date:


On 02/18/2012 09:56 AM, Michael Meskes wrote:
> Windows doesn't have strtok_r, so let's use strtok_s instead.


This broke mingw builds.

I think you need a test like:

     #if defined(WIN32) && ! defined(__GNUC__)

cheers

andrew


Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Michael Meskes
Date:
On Sat, Feb 18, 2012 at 11:26:30AM -0500, Andrew Dunstan wrote:
> I think you need a test like:
>
>     #if defined(WIN32) && ! defined(__GNUC__)

I found WIN32_ONLY_COMPILER used elsewhere and tried that. So far I've seen no
new red on the buildfarm.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Andrew Dunstan
Date:

On 02/18/2012 11:50 AM, Michael Meskes wrote:
> On Sat, Feb 18, 2012 at 11:26:30AM -0500, Andrew Dunstan wrote:
>> I think you need a test like:
>>
>>      #if defined(WIN32)&&  ! defined(__GNUC__)
> I found WIN32_ONLY_COMPILER used elsewhere and tried that. So far I've seen no
> new red on the buildfarm.
>

Yeah, that should work too.

cheers

andrew

Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Michael Meskes
Date:
On Sat, Feb 18, 2012 at 11:26:30AM -0500, Andrew Dunstan wrote:
> This broke mingw builds.

Which one of these functions is available on MinGW?

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Andrew Dunstan
Date:

On 02/18/2012 12:26 PM, Michael Meskes wrote:
> On Sat, Feb 18, 2012 at 11:26:30AM -0500, Andrew Dunstan wrote:
>> This broke mingw builds.
> Which one of these functions is available on MinGW?
>

strtok_r

cheers

andrew


Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Michael Meskes
Date:
On Sat, Feb 18, 2012 at 12:40:43PM -0500, Andrew Dunstan wrote:
> >Which one of these functions is available on MinGW?

So what is the system on pitta? It says gcc, but doesn't seem to know strtok_r.

I'm tempted to remove strtok and program the bits and pieces I need myself.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Andrew Dunstan
Date:

On 02/18/2012 02:38 PM, Michael Meskes wrote:
> On Sat, Feb 18, 2012 at 12:40:43PM -0500, Andrew Dunstan wrote:
>>> Which one of these functions is available on MinGW?
> So what is the system on pitta? It says gcc, but doesn't seem to know strtok_r.
>
> I'm tempted to remove strtok and program the bits and pieces I need myself.
>


Sorry, it looks like I was mistaken, and neither of these is available
on mingw. Could you just use plain strtok(), possibly on a copy of the
string?

cheers

andrew

Re: pgsql: Windows doesn't have strtok_r, so let's use strtok_s instead.

From
Michael Meskes
Date:
On Sat, Feb 18, 2012 at 03:12:21PM -0500, Andrew Dunstan wrote:
> Sorry, it looks like I was mistaken, and neither of these is
> available on mingw. Could you just use plain strtok(), possibly on a
> copy of the string?

I got tired of worrying about these differences and simply wrote the code
needed directly in ecpglib. Hopefully this will put this problem to rest.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL