Perform inconsequential code cleanup

This commit is contained in:
Justine Tunney 2023-08-07 20:22:49 -07:00
parent 929478c524
commit decf216655
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
52 changed files with 326 additions and 442 deletions

View file

@ -27,12 +27,14 @@
* @param 𝑛 is maximum number of characters from s to copy
* @return 𝑑
* @note 𝑑 and 𝑠 can't overlap
* @asyncsignaslenafe
* @asyncsignalsafe
*/
char *strncat(char *d, const char *s, size_t n) {
size_t o;
if (!memccpy(d + (o = strlen(d)), s, '\0', n)) {
d[o + n] = '\0';
size_t dn, sn;
if ((sn = strnlen(s, n))) {
dn = strlen(d);
memcpy(d + dn, s, sn);
d[dn + sn] = 0;
}
return d;
}