On 12/23/22 18:03, Alejandro Colomar wrote: > alx@asus5775:~/src/alx/libstp/src$ grepc -tfd stpecpy > ./stp/stpe/stpecpy.c:15: > char *stp_nullable > stpecpy(char *stp_nullable dst, char end[0], const char *restrict src) > { >     char  *stp_nullable p; > >     if (dst == end) >         return end; >     if (stp_unlikely(dst == NULL))  // Allow chaining with stpeprintf(). >         return NULL; Oh, and the two branches above can be optimized into a branch that returns dst. I wrote them expanded, for added readability, and allow the compiler reorganize it however it pleases. So, in reality, there are 2 actual branches, plus one inside memccpy(3). >     if (dst > end) >         stp_unreachable(); > >     p = memccpy(dst, src, '\0', end - dst); >     if (p != NULL) >         return p - 1; > >     /* Truncation detected. */ >     end[-1] = '\0'; >     return end; > } > > alx@asus5775:~/src/gnu/glibc$ grepc -tfd __memccpy > ./string/memccpy.c:30: > void * > __memccpy (void *dest, const void *src, int c, size_t n) > { >   void *p = memchr (src, c, n); > >   if (p != NULL) >     return __mempcpy (dest, src, p - src + 1); > >   memcpy (dest, src, n); >   return NULL; > } > --