-/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (--n4 == 0)
goto last_chars;
}
- n = n - (s1 - s) - 1;
- if (n == 0)
- return s;
- goto zero_fill;
+ s1++;
+ n = n - (s1 - s);
+ memset (s1, '\0', n);
+ return s;
}
last_chars:
}
while (c != '\0');
- zero_fill:
- do
- *++s1 = '\0';
- while (--n > 0);
-
+ memset (s1 + 1, '\0', n);
return s;
}
libc_hidden_builtin_def (strncpy)