Re: [PATCH v1 1/1] lib/string_helpers: Don't copy a tail in kstrdup_and_replace() if 'new' is \0

2023-09-14 Thread Andy Shevchenko
On Wed, Sep 13, 2023 at 12:45:57PM +0300, Andy Shevchenko wrote: > The kstrdup_and_replace() takes two characters, old and new, to replace > former with latter after the copying of the original string. But in case > when new is a NUL, there is no point to copy the rest of the string, > the

[PATCH v1 1/1] lib/string_helpers: Don't copy a tail in kstrdup_and_replace() if 'new' is \0

2023-09-13 Thread Andy Shevchenko
The kstrdup_and_replace() takes two characters, old and new, to replace former with latter after the copying of the original string. But in case when new is a NUL, there is no point to copy the rest of the string, the contract with the callers is that that the function returns a NUL-terminated