summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-09-16 22:42:03 +0000
committerLennart Poettering <lennart@poettering.net>2007-09-16 22:42:03 +0000
commit116ddaaae9267d9f89f3d127cba62763246b441c (patch)
tree6c09bd5990ed3eedc22098ade6fd511ae9274037 /src/pulsecore
parent35483eeab7d08bc3e7ab2cd7a91e3d7453dca605 (diff)
use gcc const and pure function attributes wherever applicable
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1835 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/core-util.h8
-rw-r--r--src/pulsecore/gccmacro.h19
-rw-r--r--src/pulsecore/sample-util.h4
-rw-r--r--src/pulsecore/sconv.h8
4 files changed, 29 insertions, 10 deletions
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index efd19f45..af97e4bf 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -61,14 +61,14 @@ void pa_reset_priority(void);
int pa_fd_set_cloexec(int fd, int b);
-int pa_parse_boolean(const char *s);
+int pa_parse_boolean(const char *s) PA_GCC_PURE;
char *pa_split(const char *c, const char*delimiters, const char **state);
char *pa_split_spaces(const char *c, const char **state);
char *pa_strip_nl(char *s);
-const char *pa_strsignal(int sig);
+const char *pa_strsignal(int sig) PA_GCC_PURE;
int pa_own_uid_in_group(const char *name, gid_t *gid);
int pa_uid_in_group(uid_t uid, const char *name);
@@ -85,8 +85,8 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
char *pa_hexstr(const uint8_t* d, size_t dlength, char *s, size_t slength);
size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength);
-int pa_startswith(const char *s, const char *pfx);
-int pa_endswith(const char *s, const char *sfx);
+int pa_startswith(const char *s, const char *pfx) PA_GCC_PURE;
+int pa_endswith(const char *s, const char *sfx) PA_GCC_PURE;
char *pa_runtime_path(const char *fn, char *s, size_t l);
diff --git a/src/pulsecore/gccmacro.h b/src/pulsecore/gccmacro.h
index f3ace593..d211c2e7 100644
--- a/src/pulsecore/gccmacro.h
+++ b/src/pulsecore/gccmacro.h
@@ -55,7 +55,26 @@
#ifdef __GNUC__
#define PA_GCC_DESTRUCTOR __attribute__ ((destructor))
#else
+/** Call this function when process terminates */
#define PA_GCC_DESTRUCTOR
#endif
+#ifndef PA_GCC_PURE
+#ifdef __GNUCC__
+#define PA_GCC_PURE __attribute__ ((pure))
+#else
+/** This function's return value depends only the arguments list and global state **/
+#define PA_GCC_PURE
+#endif
+#endif
+
+#ifndef PA_GCC_CONST
+#ifdef __GNUCC__
+#define PA_GCC_CONST __attribute__ ((pure))
+#else
+/** This function's return value depends only the arguments list (stricter version of PA_GCC_CONST) **/
+#define PA_GCC_CONST
+#endif
+#endif
+
#endif
diff --git a/src/pulsecore/sample-util.h b/src/pulsecore/sample-util.h
index 0d4924b1..92c6e9ff 100644
--- a/src/pulsecore/sample-util.h
+++ b/src/pulsecore/sample-util.h
@@ -56,8 +56,8 @@ void pa_volume_memchunk(
const pa_sample_spec *spec,
const pa_cvolume *volume);
-size_t pa_frame_align(size_t l, const pa_sample_spec *ss);
+size_t pa_frame_align(size_t l, const pa_sample_spec *ss) PA_GCC_PURE;
-int pa_frame_aligned(size_t l, const pa_sample_spec *ss);
+int pa_frame_aligned(size_t l, const pa_sample_spec *ss) PA_GCC_PURE;
#endif
diff --git a/src/pulsecore/sconv.h b/src/pulsecore/sconv.h
index 5e8fa684..901f50a3 100644
--- a/src/pulsecore/sconv.h
+++ b/src/pulsecore/sconv.h
@@ -29,10 +29,10 @@
typedef void (*pa_convert_func_t)(unsigned n, const void *a, void *b);
-pa_convert_func_t pa_get_convert_to_float32ne_function(pa_sample_format_t f);
-pa_convert_func_t pa_get_convert_from_float32ne_function(pa_sample_format_t f);
+pa_convert_func_t pa_get_convert_to_float32ne_function(pa_sample_format_t f) PA_GCC_PURE;
+pa_convert_func_t pa_get_convert_from_float32ne_function(pa_sample_format_t f) PA_GCC_PURE;
-pa_convert_func_t pa_get_convert_to_s16ne_function(pa_sample_format_t f);
-pa_convert_func_t pa_get_convert_from_s16ne_function(pa_sample_format_t f);
+pa_convert_func_t pa_get_convert_to_s16ne_function(pa_sample_format_t f) PA_GCC_PURE;
+pa_convert_func_t pa_get_convert_from_s16ne_function(pa_sample_format_t f) PA_GCC_PURE;
#endif