diff options
author | Jim Meyering <meyering@redhat.com> | 2011-04-24 19:06:39 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-07-02 12:35:06 +0200 |
commit | 84d048002e423dc85ae99bbb3372cd48dc1bfe72 (patch) | |
tree | f790fcb7ed23c571dd9eb4dc637a35b30978e376 /gl/lib | |
parent | 76d8e9abe18c3e3ed6dc37338b75140e06555cd5 (diff) | |
download | coreutils-84d048002e423dc85ae99bbb3372cd48dc1bfe72.tar.xz |
maint: use "const" and "pure" function attributes where possible
* configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const,
-Wsuggest-attribute=pure and -Wsuggest-attribute=noreturn.
(GNULIB_WARN_CFLAGS): But do not add them here... yet.
* src/chown-core.h (chopt_free, uid_to_name): Add function attribute(s).
* src/copy.c (is_ancestor, valid_options): Likewise.
* src/copy.h (chown_failure_ok): Likewise.
* src/dd.c (operand_matches, operand_is): Likewise.
* src/df.c (selected_fstype, excluded_fstype): Likewise.
* src/expr.c (null looks_like_integer): Likewise.
* src/md5sum.c (hex_digits): Likewise.
* src/od.c (get_lcm): Likewise.
* src/pathchk.c (component_start, component_len): Likewise.
* src/pinky.c (count_ampersands): Likewise.
* src/pr.c (cols_ready_to_print): Likewise.
* src/ptx.c (search_table): Likewise.
* src/sort.c (find_unit_order): Likewise.
* src/stty.c (mode_type_flag, string_to_baud, baud_to_value): Likewise.
* src/system.h (gcd, lcm): Likewise.
* src/tr.c (is_char_class_member, look_up_char_class): Likewise.
(star_digits_closebracket): Likewise.
* src/uniq.c (find_field): Likewise.
* src/wc.c (compute_number_width): Likewise.
* lib/xfts.h (cycle_warning_required): Likewise.
* gl/lib/randint.h (randint_get_source): Likewise.
* gl/lib/randperm.c (ceil_lg): Likewise.
* gl/lib/randperm.h (randperm_bound): Likewise.
* lib/strnumcmp.h (strintcmp): Likewise.
Diffstat (limited to 'gl/lib')
-rw-r--r-- | gl/lib/randint.h | 3 | ||||
-rw-r--r-- | gl/lib/randperm.c | 2 | ||||
-rw-r--r-- | gl/lib/randperm.h | 2 | ||||
-rw-r--r-- | gl/lib/tempname.c.diff | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/gl/lib/randint.h b/gl/lib/randint.h index edd6b1933..80c9a0e5f 100644 --- a/gl/lib/randint.h +++ b/gl/lib/randint.h @@ -34,7 +34,8 @@ struct randint_source; struct randint_source *randint_new (struct randread_source *); struct randint_source *randint_all_new (char const *, size_t); -struct randread_source *randint_get_source (struct randint_source const *); +struct randread_source *randint_get_source (struct randint_source const *) + _GL_ATTRIBUTE_PURE; randint randint_genmax (struct randint_source *, randint genmax); /* Consume random data from *S to generate a random number in the range diff --git a/gl/lib/randperm.c b/gl/lib/randperm.c index 26181b8a6..362316e23 100644 --- a/gl/lib/randperm.c +++ b/gl/lib/randperm.c @@ -30,7 +30,7 @@ /* Return the ceiling of the log base 2 of N. If N is zero, return an unspecified value. */ -static size_t +static size_t _GL_ATTRIBUTE_CONST ceil_lg (size_t n) { size_t b = 0; diff --git a/gl/lib/randperm.h b/gl/lib/randperm.h index 79bbf9fe6..0a0837aa6 100644 --- a/gl/lib/randperm.h +++ b/gl/lib/randperm.h @@ -1,4 +1,4 @@ #include "randint.h" #include <stddef.h> -size_t randperm_bound (size_t, size_t); +size_t randperm_bound (size_t, size_t) _GL_ATTRIBUTE_CONST; size_t *randperm_new (struct randint_source *, size_t, size_t); diff --git a/gl/lib/tempname.c.diff b/gl/lib/tempname.c.diff index 1bf111963..fcacf53db 100644 --- a/gl/lib/tempname.c.diff +++ b/gl/lib/tempname.c.diff @@ -22,7 +22,7 @@ index 2da5afe..562955a 100644 } #endif /* _LIBC */ -+static inline bool ++static inline bool _GL_ATTRIBUTE_PURE +check_x_suffix (char const *s, size_t len) +{ + return len <= strspn (s, "X"); |