Re: [PATCH 0/4] grep: retire `init_grep_defaults()`
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 23, 2020, 11:03 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2011231159340.56@tvgsbejvaqbjf.bet>
- In-Reply-To
- <cover.1605972564.git.martin.agren@gmail.com>
Hi Martin,
On Sat, 21 Nov 2020, Martin Ågren wrote:
Show 6 quoted lines
> Users of the grep machinery need to call `init_grep_defaults()` to > populate some defaults. There's a comment: "We could let the compiler do > this, but without C99 initializers the code gets unwieldy and > unreadable, so...". > > We have such initializers now, so we can simplify accordingly.
When I read this at first, I feared that you would change a `pthread_init_mutex()` to using `PTHREAD_MUTEX_INITIALIZER` instead. On the face of it, that would look good on paper, but it unfortunately falls flat for us because there is no Win32 equivalent for the static initializer: we emulate mutexes via `CRITICAL_SECTION`s, and those need to be initialized by running a function.
To my surprise and relief, your patches do not do that; The only mutex in `grep.c` (`grep_attr_mutex`) is not touched.
I just wanted to mention this here, in case anybody else had the same idea.
Thanks, Dscho