diff options
author | Jim Meyering <meyering@fb.com> | 2014-11-06 21:14:08 -0600 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2014-11-30 21:08:32 -0800 |
commit | 157626b785aaae6220257a23c55eb5686f4e3dbd (patch) | |
tree | 6af251e42588924a982625315c2f70762c1adc9e | |
parent | e09428778d1eb17a157e73e369f8f966fbcc8842 (diff) | |
download | sed-157626b785aaae6220257a23c55eb5686f4e3dbd.tar.gz |
maint: avoid more gcc warnings: apply _GL_ATTRIBUTE_PURE
* sed/utils.h (get_buffer, size_buffer): Make each functions
sole parameter "const" and declare the function itself with the
"pure" attribute.
* sed/utils.c (get_buffer, size_buffer): Adjust definitions to match.
-rw-r--r-- | sed/utils.c | 6 | ||||
-rw-r--r-- | sed/utils.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sed/utils.c b/sed/utils.c index ec9b2e6..f8fa031 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -81,7 +81,7 @@ panic(const char *str, ...) /* Internal routine to get a filename from open_files */ -static const char * +static const char * _GL_ATTRIBUTE_PURE utils_fp_name(FILE *fp) { struct open_file *p; @@ -477,13 +477,13 @@ init_buffer(void) } char * -get_buffer(struct buffer *b) +get_buffer(struct buffer const *b) { return b->b; } size_t -size_buffer(struct buffer *b) +size_buffer(struct buffer const *b) { return b->length; } diff --git a/sed/utils.h b/sed/utils.h index 9387369..0ce5005 100644 --- a/sed/utils.h +++ b/sed/utils.h @@ -41,8 +41,8 @@ char *ck_strdup (const char *str); void *ck_memdup (const void *buf, size_t len); struct buffer *init_buffer (void); -char *get_buffer (struct buffer *b); -size_t size_buffer (struct buffer *b); +char *get_buffer (struct buffer const *b) _GL_ATTRIBUTE_PURE; +size_t size_buffer (struct buffer const *b) _GL_ATTRIBUTE_PURE; char *add_buffer (struct buffer *b, const char *p, size_t n); char *add1_buffer (struct buffer *b, int ch); void free_buffer (struct buffer *b); |