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 /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 'lib')
-rw-r--r-- | lib/strnumcmp-in.h | 4 | ||||
-rw-r--r-- | lib/strnumcmp.c | 2 | ||||
-rw-r--r-- | lib/strnumcmp.h | 2 | ||||
-rw-r--r-- | lib/xfts.h | 3 |
4 files changed, 6 insertions, 5 deletions
diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h index dccbca539..7e963bc16 100644 --- a/lib/strnumcmp-in.h +++ b/lib/strnumcmp-in.h @@ -71,7 +71,7 @@ if digit return -1, else 0 return 0 */ -static inline int +static inline int _GL_ATTRIBUTE_PURE fraccompare (char const *a, char const *b, char decimal_point) { if (*a == decimal_point && *b == decimal_point) @@ -111,7 +111,7 @@ fraccompare (char const *a, char const *b, char decimal_point) causes comparisons to act as if there is no decimal point character, and likewise for THOUSANDS_SEP. */ -static inline int +static inline int _GL_ATTRIBUTE_PURE numcompare (char const *a, char const *b, int decimal_point, int thousands_sep) { diff --git a/lib/strnumcmp.c b/lib/strnumcmp.c index f130b5836..2dfc28c9e 100644 --- a/lib/strnumcmp.c +++ b/lib/strnumcmp.c @@ -23,7 +23,7 @@ /* Externally-visible name for numcompare. */ -int +int _GL_ATTRIBUTE_PURE strnumcmp (char const *a, char const *b, int decimal_point, int thousands_sep) { diff --git a/lib/strnumcmp.h b/lib/strnumcmp.h index 91ad3519b..4deef82bd 100644 --- a/lib/strnumcmp.h +++ b/lib/strnumcmp.h @@ -1,2 +1,2 @@ -int strintcmp (char const *, char const *); +int strintcmp (char const *, char const *) _GL_ATTRIBUTE_PURE; int strnumcmp (char const *, char const *, int, int); diff --git a/lib/xfts.h b/lib/xfts.h index fc3ba9010..f903f4804 100644 --- a/lib/xfts.h +++ b/lib/xfts.h @@ -6,4 +6,5 @@ xfts_open (char * const *, int options, int (*) (const FTSENT **, const FTSENT **)); bool -cycle_warning_required (FTS const *fts, FTSENT const *ent); +cycle_warning_required (FTS const *fts, FTSENT const *ent) + _GL_ATTRIBUTE_PURE; |