From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: replace strtok() |
Date: | 2024-10-17 12:35:40 |
Message-ID: | CAEudQAqVyLhBNNewR-Q4b+Tu4nHk3PBtBPvepX63mryFde1jdw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em qui., 17 de out. de 2024 às 07:30, Alexander Lakhin <exclusion(at)gmail(dot)com>
escreveu:
> Hello Ranier,
>
> 16.10.2024 14:14, Ranier Vilela wrote:
>
> Em qua., 16 de out. de 2024 às 04:45, Peter Eisentraut <
> peter(at)eisentraut(dot)org> escreveu:
>
>>
>> This wouldn't fix anything, I think. If colors is NULL, then strsep()
>> already returns NULL, so the added code does nothing.
>>
> If *colors* is NULL, then the delimiter is not found and strsep will
> return the entire
> string **stringp, so the token becomes invalid*.
>
> IMO, I think it must be necessary to check if *colors* are NULL too.
>
>
> I've tested your proposed change and what I'm seeing is that:
> PG_COLOR=always PG_COLORS="error=01;31" initdb
> doesn't color the "error" word:
>
> while with only Peter's patch it works as expected:
>
>
> Does your change work differently for you?
>
No.
Thanks for the test.
It seems to me that with strsep, the only alternative is to run the risk of
processing an invalid token?
I ran the test with Peter's patch in Windows and the terminal doesn't
color the "error" word, perhaps this feature does not work with Windows.
[image: error1.png]
I withdraw the proposed patch.
best regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Seino Yuki | 2024-10-17 13:15:51 | Re: Add “FOR UPDATE NOWAIT” lock details to the log. |
Previous Message | Daniel Gustafsson | 2024-10-17 12:24:33 | Re: wrong comment in libpq.h |