aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-28 22:14:49 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-28 22:14:49 +0000
commit173525f1d66d38e2f83ebbda4c3778c7007850b6 (patch)
treef5b50f449931ed02dc5edd889c1ccb481e053563 /include
parentf768188647ec3c0ba83664c214d7622127812a52 (diff)
Add the function attribute "pure" or "const" to various functions that perform
int to string or string to int operations. "pure" essentially says that this function has no side effects aside from its result, and the result depends on nothing else other than its arguments and global variables. "const" is a more strict form of "pure", where the function also doesn't access any global variables. From the gcc manual: "Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be." This also tells the compiler that it is safe to call the function fewer times than the code says to, given the same arguments, since the result will always be the same. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@38452 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/channel.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index fe2b33ed9..1af18717e 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -955,14 +955,14 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
* Give a name to a cause code
* Returns the text form of the binary cause code given
*/
-const char *ast_cause2str(int state);
+const char *ast_cause2str(int state) __attribute__ ((pure));
/*! Convert the string form of a cause code to a number */
/*!
* \param name string form of the cause
* Returns the cause code
*/
-int ast_str2cause(const char *name);
+int ast_str2cause(const char *name) __attribute__ ((pure));
/*! Gives the string form of a given channel state */
/*!
@@ -979,7 +979,7 @@ char *ast_state2str(int state);
* See above
* Returns the text form of the binary transfer capbility
*/
-char *ast_transfercapability2str(int transfercapability);
+char *ast_transfercapability2str(int transfercapability) __attribute__ ((const));
/* Options: Some low-level drivers may implement "options" allowing fine tuning of the
low level channel. See frame.h for options. Note that many channel drivers may support