Message ID | cover.1605972564.git.martin.agren@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | grep: retire `init_grep_defaults()` | expand |
Hi Martin, On Sat, 21 Nov 2020, Martin Ågren wrote: > 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