Re: [PATCH] dm: Add support for escaped characters in str_field_delimit()

From: Abhinav Jain
Date: Thu Jun 13 2024 - 12:30:33 EST


On Mon, Jun 10, 2024 at 01:11:40PM -0400, Benjamin Marzinski wrote:
> This doesn't do anything to the escape character. Presumably you want to
> pass the field containing a separator down to dm_eary_create(). But you
> don't want to pass the escape character itself.
>
> To work correctly, this code needs to remove all those escape characters
> that come before separators. It probably needs to do something like:
>
> 1. Find a next non-escaped separator and change it to NULL, so you have
> your field string.
>
> 2. Find all the escaped separators in the field string, and shift the
> rest of the string over to overwrite the escape character with the rest
> of the string.
>
> -Ben

Hi Ben,

I realised I should have done better testing after processing your feedback.
I have accordingly modified the code and shared a v2:
https://lore.kernel.org/all/20240613162632.38065-1-jain.abhinav177@xxxxxxxxx/

Please help review and provide feedback again. Thanks.