Re: [PATCH 6/7] CLI: make static message strings const

Subject: Re: [PATCH 6/7] CLI: make static message strings const

Date: Fri, 14 May 2021 17:39:33 +0300

To: David Bremner,


From: Tomi Ollila

On Fri, May 14 2021, David Bremner wrote:

> Tomi Ollila <> writes:
>> In my projects I've been using the following macro:
>> #define WriteCS(fd, str) write((fd), (str), sizeof(str) - 1)
>> but I don't know if that behaved any better (if we cared)...
> I'm not sure. The sizeof here is actually slightly treacherous (iiuc,
> making things const char * will blow up the world) so I prefer it out in
> the open.

Right, const char * would make sizeof 8 (or 4).

(I just fixed bug somewhere where first 4 chars of strings were
compared for equality ;/).

The WriteCS meant (Const String), perhaps LS (Literal String) would be 
better. (and write((fd), "" str "", sizeof(str) - 1)).

... have to check if this works, and start using if it works as expected!


>> But, in addition to these two identical copies of handle_sigint()
>> also notmuch-new.c and notmuch-reindex.c defines anoter 2 identical
>> copies of handle_sigint()...
>> I did not see that those two were also modified in this series...
> Good catch! I did the same for those two and pushed the modified series.
notmuch mailing list --
To unsubscribe send an email to