[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180822003203.GA2218@jagdpanzerIV>
Date: Wed, 22 Aug 2018 09:32:03 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>, Martin Wilck <mwilck@...e.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC][PATCH] lib/string: introduce sysfs_strncpy() and
sysfs_strlcpy()
On (08/21/18 15:00), Andy Shevchenko wrote:
> > Returning the length of dst/-EOVERFLOW is a bit inconvenient, because
> > "the length" forces us to have size_t return, which is unsigned.
>
> We have for ages ssize_t to workaround that.
OK.
[..]
> Wouldn't be better to split out something like
>
> strnstrip() out of strim(), with simultaneous changes to strim(),
> strstrip(), and use it here?
Maybe yes, maybe not. strim() modifies the original string right after
it's done moving the end pointer. We can't do that in strcpy_trim() and
need to keep the original source string. So probably these two functions
don't have that much of a common code after all.
-ss
Powered by blists - more mailing lists