summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-01-28 18:23:36 +0100
committerJim Meyering <meyering@redhat.com>2012-01-31 13:22:05 +0100
commit6835b68f981f53f9b91680e9acfb64cdfc6b870b (patch)
treef447c4e4ee83f4f50ab1866d9716e02737444921 /src
parent7cc3d956e660c42c1597e4cc6521f94454f9a8b0 (diff)
downloadidutils-6835b68f981f53f9b91680e9acfb64cdfc6b870b.tar.gz
idutils-6835b68f981f53f9b91680e9acfb64cdfc6b870b.tar.bz2
idutils-6835b68f981f53f9b91680e9acfb64cdfc6b870b.zip
build: add const and pure attributes, per gcc recommendation
* src/mkid.c (ceil_log_8, ceil_log_2): Add "const" attribute. (token_hash_1, token_hash_2): Add "pure" attribute. (token_hash_cmp, token_qsort_cmp): Likewise. (count_vec_size, count_buf_size): Likewise. * libidu/idu-hash.c (round_up_2): Add "const" attribute. * libidu/scanners.h (get_language): Add "pure" attribute. * libidu/idfile.h (token_flags): Likewise. (token_count): Likewise. (member_file_qsort_compare): Likewise. (tree8_count_levels): Add "const" attribute. * libidu/walker.c (symlink_ancestry): Add "pure" attribute. (links_depth): Likewise. (file_link_hash_1): Likewise. (vector_length): Likewise. (file_link_hash_compare): Likewise. (string_in_vector): Likewise. * src/lid.c (vector_cardinality, get_radix, dtoi, otoi): Likewise. (is_regexp): Likewise. (vector_length): Remove forward decl and move function definition to precede first use.
Diffstat (limited to 'src')
-rw-r--r--src/lid.c14
-rw-r--r--src/mkid.c16
2 files changed, 15 insertions, 15 deletions
diff --git a/src/lid.c b/src/lid.c
index 9a5054b..cd307c0 100644
--- a/src/lid.c
+++ b/src/lid.c
@@ -810,7 +810,7 @@ report_nothing (char const *name, struct file_link **flinkv ATTRIBUTE_UNUSED)
puts (name);
}
-static int
+static int _GL_ATTRIBUTE_PURE
vector_cardinality (void *vector)
{
void **v = (void **) vector;
@@ -1239,7 +1239,7 @@ query_binary_search (char const *token_0)
/* Are there any regexp meta-characters in name?? */
-static int
+static int _GL_ATTRIBUTE_PURE
is_regexp (char *name)
{
int backslash = 0;
@@ -1284,7 +1284,7 @@ has_right_delimiter (char const *pattern)
/* Does `name' occur in `line' delimited by non-alphanumerics?? */
-static int
+static int _GL_ATTRIBUTE_PURE
word_match (char const *name_0, char const *line)
{
char const *name = name_0;
@@ -1319,7 +1319,7 @@ word_match (char const *name_0, char const *line)
apply. In particular, it is impossible to determine the radix of
0, so return all possibilities. */
-static int
+static int _GL_ATTRIBUTE_PURE
get_radix (char const *str)
{
if (!isdigit (*str))
@@ -1374,7 +1374,7 @@ stoi (char const *str)
/* Convert an ascii octal number to an integer. */
-static int
+static int _GL_ATTRIBUTE_PURE
otoi (char const *str)
{
int n = 0;
@@ -1391,7 +1391,7 @@ otoi (char const *str)
/* Convert an ascii decimal number to an integer. */
-static int
+static int _GL_ATTRIBUTE_PURE
dtoi (char const *str)
{
int n = 0;
@@ -1408,7 +1408,7 @@ dtoi (char const *str)
/* Convert an ascii hex number to an integer. */
-static int
+static int _GL_ATTRIBUTE_PURE
xtoi (char const *str)
{
int n = 0;
diff --git a/src/mkid.c b/src/mkid.c
index 821e8d3..082395e 100644
--- a/src/mkid.c
+++ b/src/mkid.c
@@ -443,7 +443,7 @@ main (int argc, char **argv)
/* Return the integer ceiling of the base-8 logarithm of N. */
-static int
+static int _GL_ATTRIBUTE_CONST
ceil_log_8 (unsigned long n)
{
int log_8 = 0;
@@ -459,7 +459,7 @@ ceil_log_8 (unsigned long n)
/* Return the integer ceiling of the base-2 logarithm of N. */
-static int
+static int _GL_ATTRIBUTE_CONST
ceil_log_2 (unsigned long n)
{
int log_2 = 0;
@@ -782,26 +782,26 @@ write_id_file (struct idhead *idhp)
/* Define primary and secondary hash and comparison functions for the
token table. */
-static unsigned long
+static unsigned long _GL_ATTRIBUTE_PURE
token_hash_1 (void const *key)
{
return_STRING_HASH_1 (TOKEN_NAME ((struct token const *) key));
}
-static unsigned long
+static unsigned long _GL_ATTRIBUTE_PURE
token_hash_2 (void const *key)
{
return_STRING_HASH_2 (TOKEN_NAME ((struct token const *) key));
}
-static int
+static int _GL_ATTRIBUTE_PURE
token_hash_cmp (void const *x, void const *y)
{
return_STRING_COMPARE (TOKEN_NAME ((struct token const *) x),
TOKEN_NAME ((struct token const *) y));
}
-static int
+static int _GL_ATTRIBUTE_PURE
token_qsort_cmp (void const *x, void const *y)
{
return_STRING_COMPARE (TOKEN_NAME (*(struct token const *const *) x),
@@ -938,7 +938,7 @@ make_sibling_summary (struct summary *summary)
return summary;
}
-static int
+static int _GL_ATTRIBUTE_PURE
count_vec_size (struct summary *summary, unsigned char const *tail_hits)
{
struct summary **kids;
@@ -962,7 +962,7 @@ count_vec_size (struct summary *summary, unsigned char const *tail_hits)
}
}
-static int
+static int _GL_ATTRIBUTE_PURE
count_buf_size (struct summary *summary, unsigned char const *tail_hits)
{
struct summary **kids;