3 <<strcat>>---concatenate strings
10 char *strcat(char *restrict <[dst]>, const char *restrict <[src]>);
13 <<strcat>> appends a copy of the string pointed to by <[src]>
14 (including the terminating null character) to the end of the
15 string pointed to by <[dst]>. The initial character of
16 <[src]> overwrites the null character at the end of <[dst]>.
19 This function returns the initial value of <[dst]>
24 <<strcat>> requires no supporting OS subroutines.
33 /* Nonzero if X is aligned on a "long" boundary. */
35 (((long)X & (sizeof (long) - 1)) == 0)
37 #if LONG_MAX == 2147483647L
38 #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
40 #if LONG_MAX == 9223372036854775807L
41 /* Nonzero if X (a long int) contains a NULL byte. */
42 #define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080)
44 #error long int is not a 32bit or 64bit type.
49 #error long int is not a 32bit or 64bit byte
57 strcat (char *__restrict s1
,
58 const char *__restrict s2
)
60 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
73 /* Skip over the data in s1 as quickly as possible. */
76 unsigned long *aligned_s1
= (unsigned long *)s1
;
77 while (!DETECTNULL (*aligned_s1
))
80 s1
= (char *)aligned_s1
;
86 /* s1 now points to the its trailing null character, we can
87 just use strcpy to do the work for us now.
89 ?!? We might want to just include strcpy here.
90 Also, this will cause many more unaligned string copies because
91 s1 is much less likely to be aligned. I don't know if its worth
92 tweaking strcpy to handle this better. */
96 #endif /* not PREFER_SIZE_OVER_SPEED */