Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/safe_strncpy.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/safe_strncpy.c
r1765 r2725 5 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 … … 11 11 12 12 /* Like strncpy but make sure the resulting string is always 0 terminated. */ 13 char *safe_strncpy(char *dst, const char *src, size_t size)13 char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size) 14 14 { 15 15 if (!size) return dst; … … 17 17 return strncpy(dst, src, size); 18 18 } 19 20 /* Like strcpy but can copy overlapping strings. */ 21 void FAST_FUNC overlapping_strcpy(char *dst, const char *src) 22 { 23 /* Cheap optimization for dst == src case - 24 * better to have it here than in many callers. 25 */ 26 if (dst != src) { 27 while ((*dst = *src) != '\0') { 28 dst++; 29 src++; 30 } 31 } 32 }
Note:
See TracChangeset
for help on using the changeset viewer.