lkml.org 
[lkml]   [2023]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3] x86/platform/uv: refactor deprecated strcpy and strncpy
On Wed, Sep 6, 2023 at 3:16 PM Hans de Goede <hdegoede@redhat.com> 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

\
 
 \ /
  Last update: 2023-09-06 15:31    [W:0.060 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site