summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-07-28 22:14:49 +0000
committerRussell Bryant <russell@russellbryant.com>2006-07-28 22:14:49 +0000
commitd6246e579fe573bff336e4d8de3787273b3a4721 (patch)
treef5b50f449931ed02dc5edd889c1ccb481e053563 /include/asterisk
parent88cea437ab547d93a17ca6988fc5accddde1ced1 (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: https://origsvn.digium.com/svn/asterisk/trunk@38452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-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