aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/strings.h
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-21 21:13:09 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-21 21:13:09 +0000
commit230a66da7d98b2b6d328a04b0e7180b94d9c76bf (patch)
treeb40d978190102dbe6f14458ab8a70f358db533e4 /include/asterisk/strings.h
parentd57c20e50d7105f72bb90e709965ad5e04c5e36a (diff)
Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes: - CLI command handlers - CLI command handler arguments - AGI command handlers - AGI command handler arguments - Dialplan application handler arguments - Speech engine API function arguments In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing. Review: https://reviewboard.asterisk.org/r/251/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/strings.h')
-rw-r--r--include/asterisk/strings.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 43ba361f4..ae58af3ef 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -281,7 +281,7 @@ int attribute_pure ast_false(const char *val);
* string. It will also place a space in the result buffer in between each
* string from 'w'.
*/
-void ast_join(char *s, size_t len, char * const w[]);
+void ast_join(char *s, size_t len, const char * const w[]);
/*
\brief Parse a time (integer) string.
@@ -454,7 +454,7 @@ void ast_str_trim_blanks(struct ast_str *buf),
* \param buf A pointer to the ast_str structure.
*/
AST_INLINE_API(
-size_t attribute_pure ast_str_strlen(struct ast_str *buf),
+size_t attribute_pure ast_str_strlen(const struct ast_str *buf),
{
return buf->__AST_STR_USED;
}
@@ -465,7 +465,7 @@ size_t attribute_pure ast_str_strlen(struct ast_str *buf),
* \retval Current maximum length of the buffer.
*/
AST_INLINE_API(
-size_t attribute_pure ast_str_size(struct ast_str *buf),
+size_t attribute_pure ast_str_size(const struct ast_str *buf),
{
return buf->__AST_STR_LEN;
}
@@ -476,9 +476,13 @@ size_t attribute_pure ast_str_size(struct ast_str *buf),
* \retval A pointer to the enclosed string.
*/
AST_INLINE_API(
-char * attribute_pure ast_str_buffer(struct ast_str *buf),
+char * attribute_pure ast_str_buffer(const struct ast_str *buf),
{
- return buf->__AST_STR_STR;
+ /* for now, cast away the const qualifier on the pointer
+ * being returned; eventually, it should become truly const
+ * and only be modified via accessor functions
+ */
+ return (char *) buf->__AST_STR_STR;
}
)