aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-14 02:35:25 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-14 02:35:25 +0100
commit567f95688269e7255bce779c44d93ed587867086 (patch)
treeaf56d431baf727f0e2fe14877b3d6dce64d423f7
parentm (diff)
downloadslibc-567f95688269e7255bce779c44d93ed587867086.tar.gz
slibc-567f95688269e7255bce779c44d93ed587867086.tar.bz2
slibc-567f95688269e7255bce779c44d93ed587867086.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/slibc-human.h12
-rw-r--r--src/slibc-human/escape.c8
2 files changed, 10 insertions, 10 deletions
diff --git a/include/slibc-human.h b/include/slibc-human.h
index 9ebba26..6f5a603 100644
--- a/include/slibc-human.h
+++ b/include/slibc-human.h
@@ -160,18 +160,18 @@ enum machinesize_mode
-char* humanmode(const char* buffer, mode_t mode);
+char* humanmode(const char* restrict buffer, mode_t mode);
-mode_t machinemode(const char* str, mode_t mode, mode_t mask);
+mode_t machinemode(const char* restrict str, mode_t mode, mode_t mask);
-char* humansize(const char* buffer, size_t size, enum humansize_mode mode, int detail);
+char* humansize(const char* restrict buffer, size_t size, enum humansize_mode mode, int detail);
-int machinesize(size_t* restrict size, char* string, enum machinesize_mode mode);
+int machinesize(size_t* restrict size, const char* restrict string, enum machinesize_mode mode);
#ifdef __C99__
-int humandur(intmax_t restrict sec, long int nsec, const char* comma, const char* format);
+int humandur(intmax_t sec, long int nsec, const char* restrict comma, const char* restrict format);
int machinedur(intmax_t* restrict sec, long int* nsec, const char* restrict str,
const char* restrict space, const char* restrict comma);
@@ -229,7 +229,7 @@ char* unescape(char*, enum unescape_mode);
* @throws EINVAL If `quote` is invalid.
* @throws ENOMEM The process cannot allocate more memory.
*/
-char* escape(const char*)
+char* escape(const char* restrict)
__GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__)));
diff --git a/src/slibc-human/escape.c b/src/slibc-human/escape.c
index ea93108..e3be732 100644
--- a/src/slibc-human/escape.c
+++ b/src/slibc-human/escape.c
@@ -37,11 +37,11 @@
* @throws EINVAL If `quote` is invalid.
* @throws ENOMEM The process cannot allocate more memory.
*/
-char* escape(const char* str, char quote)
+char* escape(const char* restrict str, char quote)
{
- char* r;
- char* w;
- char* rc;
+ const char* restrict r;
+ char* restrict w;
+ char* restrict rc;
size_t extra = 1, len, size;
unsigned char c;