Re: [PATCH v3] x86/platform/uv: refactor deprecated strcpy and strncpy

From: Andy Shevchenko
Date: Wed Sep 06 2023 - 09:30:55 EST


On Wed, Sep 6, 2023 at 3:16 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
> On 9/6/23 14:10, Ingo Molnar wrote:

> strscpy(arg, val, strnchrnul(val, sizeof(arg)-1, '\n') - val + 1);

If you want to make it short and more readable, you can use

strscpy(arg, val, sizeof(arg));
strreplace(arg, '\n', '\0');

--
With Best Regards,
Andy Shevchenko