Mark a couple of functions as const.
authorAndre Noll <maan@systemlinux.org>
Tue, 29 Mar 2011 20:03:54 +0000 (22:03 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 23 Apr 2011 14:09:35 +0000 (16:09 +0200)
Probably does not matter much..

Makefile.in
afs.c
aft.c
fec.c
gcc-compat.h
imdct.c
mood.c
wma_common.c

index 8ecc1b8f6d606497aff2e9291e9b962d698cd28e..ca79f8b9948235970e31da5c9ecf2a96a53b9672 100644 (file)
@@ -32,6 +32,7 @@ DEBUG_CPPFLAGS += -Wmissing-format-attribute
 # DEBUG_CPPFLAGS += -Wextra
 # DEBUG_CPPFLAGS += -Wold-style-definition
 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
+# DEBUG_CPPFLAGS += -Wsuggest-attribute=const
 
 # many warnings about trivial stuff
 # CPPFLAGS += -Wconversion
diff --git a/afs.c b/afs.c
index ac75164c0291f955c80857876fa8af48607e2814..755537da9e436ab8705222925fa3c737f648eab1 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -1148,7 +1148,7 @@ void afs_event(enum afs_events event, struct para_buffer *pb,
  *
  * This table does not honor events.
  */
-int images_event_handler(__a_unused enum afs_events event,
+__a_const int images_event_handler(__a_unused enum afs_events event,
        __a_unused  struct para_buffer *pb, __a_unused void *data)
 {
        return 1;
@@ -1163,7 +1163,7 @@ int images_event_handler(__a_unused enum afs_events event,
  *
  * This table does not honor events.
  */
-int lyrics_event_handler(__a_unused enum afs_events event,
+__a_const int lyrics_event_handler(__a_unused enum afs_events event,
        __a_unused struct para_buffer *pb, __a_unused void *data)
 {
        return 1;
diff --git a/aft.c b/aft.c
index 157b5a626b58306647fd3a09502efe992ed44bdc..be4d572e22f1517d1f5c3c970d30e6f6671f4158 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -723,7 +723,7 @@ static int get_local_time(uint64_t *seconds, char *buf, size_t size,
                } \
        }
 
-static short unsigned get_duration_width(int seconds)
+__a_const static short unsigned get_duration_width(int seconds)
 {
        short unsigned width;
        unsigned hours = seconds / 3600, mins = (seconds % 3600) / 60;
diff --git a/fec.c b/fec.c
index 233a87803ebcf06fe38d172473cfa15e23b17c96..e5c2a3b83e005c8596e6bcf951702bc3cb2cf5e1 100644 (file)
--- a/fec.c
+++ b/fec.c
@@ -74,7 +74,7 @@ static unsigned char gf_mul_table[GF_SIZE + 1][GF_SIZE + 1];
 #define gf_mul(x,y) gf_mul_table[x][y]
 
 /* Compute x % GF_SIZE without a slow divide. */
-static inline unsigned char modnn(int x)
+__a_const static inline unsigned char modnn(int x)
 {
        while (x >= GF_SIZE) {
                x -= GF_SIZE;
index 45d9c9ba8dcf1497001014a6fa06841c427d08be..ba1d82ead77ac6ae937a15a4e691ba8afc2f21b2 100644 (file)
@@ -9,6 +9,7 @@
  * the number of the first variadic parameter.
  */
 # define __printf(p,q) __attribute__ ((format (printf, p, q)))
+# define __a_const __attribute__ ((const))
 /*
  * as direct use of __printf(p,q) confuses doxygen, here are two extra macros
  * for those values p,q that are actually used by paraslash.
diff --git a/imdct.c b/imdct.c
index e926499393bc1fadcd0bedc251cc74ce7d9585de..32928487b724653535d604adbf690e013a7eb516 100644 (file)
--- a/imdct.c
+++ b/imdct.c
@@ -80,7 +80,7 @@ static fftsample_t *cos_tabs[] = {
        cos_4096, cos_8192, cos_16384, cos_32768, cos_65536,
 };
 
-static int split_radix_permutation(int i, int n)
+__a_const static int split_radix_permutation(int i, int n)
 {
        int m;
        if (n <= 2)
diff --git a/mood.c b/mood.c
index 732df0a32f8d1e7d19d08f04c773dc5026589caf..d82d5a52c3b704cffd3657c9b6bad25121c5b4f2 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -79,13 +79,13 @@ struct mood {
 static struct mood *current_mood;
 
 /**
- *  Rough approximation to sqrt.
+ * Rough approximation to sqrt.
  *
- *  \param x Integer of which to calculate the sqrt.
+ * \param x Integer of which to calculate the sqrt.
  *
- *  \return An integer res with res * res <= x.
+ * \return An integer res with res * res <= x.
  */
-static uint64_t int_sqrt(uint64_t x)
+__a_const static uint64_t int_sqrt(uint64_t x)
 {
        uint64_t op, res, one = 1;
        op = x;
index 781db5f4a36678f14db97a165b02e8f41df3e8b8..137d288d078a612495a445211581c0a061cabf70 100644 (file)
@@ -142,7 +142,7 @@ const uint8_t log2_tab[256] = {
  *
  * \return An integer approximation of log2(v).
  */
-int wma_log2(unsigned int v)
+__a_const int wma_log2(unsigned int v)
 {
        int n = 0;
        if (v & 0xffff0000) {