Messages in this thread | | | From | Nick Desaulniers <> | Date | Fri, 14 Aug 2020 19:00:22 -0700 | Subject | Re: [PATCH] lib/string.c: implement stpcpy |
| |
On Fri, Aug 14, 2020 at 5:52 PM Joe Perches <joe@perches.com> wrote: > > On Fri, 2020-08-14 at 17:24 -0700, Nick Desaulniers wrote: > > LLVM implemented a recent "libcall optimization" that lowers calls to > > `sprintf(dest, "%s", str)` where the return value is used to > > `stpcpy(dest, str) - dest`. This generally avoids the machinery involved > > in parsing format strings. > [] > > diff --git a/include/linux/string.h b/include/linux/string.h > [] > > @@ -31,6 +31,9 @@ size_t strlcpy(char *, const char *, size_t); > > #ifndef __HAVE_ARCH_STRSCPY > > ssize_t strscpy(char *, const char *, size_t); > > #endif > > +#ifndef __HAVE_ARCH_STPCPY > > +extern char *stpcpy(char *__restrict, const char *__restrict__); > > Why use two different forms for __restrict and __restrict__? > Any real reason to use __restrict__ at all?
Bah, sorry, I recently enabled some setting in my ~/.vimrc to help me find my cursor better: " highlight cursor set cursorline set cursorcolumn
Turns out this makes it pretty difficult to see underscores, or the lack thereof. Will fix up.
> > It's used nowhere else in the kernel. > > $ git grep -w -P '__restrict_{0,2}' > scripts/genksyms/keywords.c: // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO > scripts/genksyms/keywords.c: { "__restrict__", RESTRICT_KEYW }, > >
-- Thanks, ~Nick Desaulniers
| |