ppp icon indicating copy to clipboard operation
ppp copied to clipboard

Exit early if we strlen on an empty string

Open AZero13 opened this issue 1 year ago • 2 comments

In the event we do strlen on an empty string, we should bail.

AZero13 avatar May 22 '24 23:05 AZero13

In the context of the existing code, the change proposed is reasonable, but the commit message is not illuminating, because it doesn't explain the connection between an empty string and bailing out. The mention of strlen doesn't help - doing strlen on an empty string is fine.

I think the existing code is actually buggy and has been buggy since it was first written, in that it treats all allowed number strings as wildcards, whether there is a '*' on the end or not. I don't think that was really the original intention. That means that an empty string is equivalent to "*", and that is why bailing out on an empty string is correct (in terms of fixing the code without changing its behaviour).

paulusmack avatar May 23 '24 10:05 paulusmack

@AtariDreams: Have you seen the @paulusmack answer?

Neustradamus avatar Jul 27 '24 10:07 Neustradamus

never mind... I pushed a change to make it handle non-wildcards correctly, which also solves the issue this PR was addressing.

paulusmack avatar Aug 18 '24 23:08 paulusmack