|
Message-ID: <20220616164523.GL7074@brightrain.aerifal.cx> Date: Thu, 16 Jun 2022 12:45:23 -0400 From: Rich Felker <dalias@...c.org> To: NRK <nrk@...root.org> Cc: musl@...ts.openwall.com Subject: Re: hostname is using a case sensitive search in function name_from_hosts On Thu, Jun 16, 2022 at 10:19:24PM +0600, NRK wrote: > On Thu, Jun 09, 2022 at 04:34:27PM -0400, Rich Felker wrote: > > strcasestr isn't a good match here, because it's quadratic time and > > would be potentially quite slow (depending on file contents). It's > > also not in a usable namespace, and is something of a junk function we > > included for questionable reasons. > > A bit off-topic, but is there any desire to improve the strcasestr > performance? If there is, then I can supply the patch as I was playing > around with it a couple weeks ago. I'm not sure. It's an interesting research problem whether it can be made linear-time in constant space -- I mean, for a dumb single-byte-only version like we do now, I'm pretty sure it can, but I'm doubtful the same can be done for one that respects full multibyte case mapping. But aside from that, I'm not sure if there's much practical value. The function is not really appropriate for much real-world use, especially as long as it doesn't respect non-ASCII case mappings, and was probably a mistake to include to begin with. If there are simple changes that could be made to make it "less awfully slow", that's probably ok, but anything that involves open-coding a more complex implementation without actually making this a high-quality usable function seems like an unwanted increase in code complexity and potential bug-surface/maintenance-burden without a good motivation. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.