summaryrefslogtreecommitdiff
path: root/util/str.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/str.c')
-rw-r--r--util/str.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/util/str.c b/util/str.c
deleted file mode 100644
index ac4fb26..0000000
--- a/util/str.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-A better alternative to strncpy. dest is guaranteed to be a null-terminated string
-after this function is run.
-Returns the number of characters copied to dest, not including the null character.
-destsz must be greater than 0.
-*/
-size_t str_copy(char *dest, size_t destsz, const char *src) {
- assert(destsz);
- if (!*src) {
- *dest = 0;
- return 0;
- }
- for (size_t i = 0; i < destsz-1; i++) {
- *dest = *src;
- if (!*src) {
- *dest = 0;
- return i;
- }
- src++; dest++;
- }
- dest[destsz-1] = 0;
- return destsz-1;
-}