[llvm-commits] CVS: llvm/runtime/GCCLibraries/libc/string.c
Chris Lattner
lattner at cs.uiuc.edu
Fri Feb 20 14:16:01 PST 2004
Changes in directory llvm/runtime/GCCLibraries/libc:
string.c updated: 1.7 -> 1.8
---
Log message:
Add a simple implementation of strncpy
---
Diffs of the changes: (+6 -0)
Index: llvm/runtime/GCCLibraries/libc/string.c
diff -u llvm/runtime/GCCLibraries/libc/string.c:1.7 llvm/runtime/GCCLibraries/libc/string.c:1.8
--- llvm/runtime/GCCLibraries/libc/string.c:1.7 Thu Feb 19 15:44:41 2004
+++ llvm/runtime/GCCLibraries/libc/string.c Fri Feb 20 14:15:47 2004
@@ -35,6 +35,12 @@
return dest;
}
+char *strncpy(char *s1, const char *s2, size_t n) {
+ char *dest = s1;
+ while (n-- && (*s1++ = *s2++));
+ return dest;
+}
+
char *strcat(char *s1, const char *s2) {
strcpy(s1+strlen(s1), s2);
return s1;
More information about the llvm-commits
mailing list