summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-07-21 12:08:31 +0200
committerJim Meyering <meyering@redhat.com>2012-07-21 12:08:31 +0200
commit7308099bbc38c64fef2da2f5cf8d32c149400065 (patch)
treebe6effc0e5be1a19c95645e40a065f1fdf149428
parentf24bf0448e88321a01fad18ded110fbb1545ca15 (diff)
downloadcoreutils-7308099bbc38c64fef2da2f5cf8d32c149400065.tar.xz
maint: stzncpy: restrict pointer parameters
* src/system.h (stzncpy): Add "restrict" attribute to each pointer parameter and note in the comment that the buffers must not overlap.
-rw-r--r--src/system.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/system.h b/src/system.h
index 6907603e6..06cc803b1 100644
--- a/src/system.h
+++ b/src/system.h
@@ -628,10 +628,11 @@ The following directory is part of the cycle:\n %s\n"), \
/* Like stpncpy, but do ensure that the result is NUL-terminated,
and do not NUL-pad out to LEN. I.e., when strnlen (src, len) == len,
- this function writes a NUL byte into dest[len]. Thus, the destination
- buffer must be at least LEN+1 bytes long. */
+ this function writes a NUL byte into dest[len]. Thus, the length
+ of the destination buffer must be at least LEN + 1.
+ The DEST and SRC buffers must not overlap. */
static inline char *
-stzncpy (char *dest, char const *src, size_t len)
+stzncpy (char *restrict dest, char const *restrict src, size_t len)
{
char const *src_end = src + len;
while (src < src_end && *src)