mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
a small upgrade to the coding standard, and an update to the code that triggered the upgrade.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63048 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -11647,7 +11647,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||
return;
|
||||
} else if (!ast_strlen_zero(c = get_header(req, "Record"))) {
|
||||
/* first, get the feature string, if it exists */
|
||||
struct ast_call_feature *feat = find_feature("automon");
|
||||
struct ast_call_feature *feat = ast_find_call_feature("automon");
|
||||
|
||||
if (!feat || ast_strlen_zero(feat->exten)) {
|
||||
ast_log(LOG_WARNING,"Recording requested, but no One Touch Monitor registered. (See features.conf)\n");
|
||||
|
@@ -206,6 +206,18 @@ alloca(), and similar functions do not _ever_ need to be cast to a specific
|
||||
type, and when you are passing a pointer to (for example) a callback function
|
||||
that accepts a 'void *' you do not need to cast into that type.
|
||||
|
||||
* Function naming
|
||||
-----------------
|
||||
|
||||
All public functions (those not marked 'static'), must be named "ast_<something>"
|
||||
and have a descriptive name.
|
||||
|
||||
As an example, suppose you wanted to take a local function "find_feature", defined
|
||||
as static in a file, and used only in that file, and make it public, and use it
|
||||
in other files. You will have to remove the "static" declaration and define a
|
||||
prototype in an appropriate header file (usually in include/asterisk). A more
|
||||
specific name should be given, such as "ast_find_call_feature".
|
||||
|
||||
* Variable naming
|
||||
-----------------
|
||||
|
||||
@@ -225,11 +237,7 @@ options that they are in fact intended to be global.
|
||||
- Don't use un-necessary typedef's
|
||||
Don't use 'typedef' just to shorten the amount of typing; there is no substantial
|
||||
benefit in this:
|
||||
|
||||
struct foo {
|
||||
int bar;
|
||||
};
|
||||
typedef foo_t struct foo;
|
||||
struct foo { int bar; }; typedef foo_t struct foo;
|
||||
|
||||
In fact, don't use 'variable type' suffixes at all; it's much preferable to
|
||||
just type 'struct foo' rather than 'foo_s'.
|
||||
|
@@ -94,8 +94,8 @@ void ast_register_feature(struct ast_call_feature *feature);
|
||||
\param feature the ast_call_feature object which was registered before*/
|
||||
void ast_unregister_feature(struct ast_call_feature *feature);
|
||||
|
||||
/*! \brief look for a feature entry by its sname
|
||||
/*! \brief look for a call feature entry by its sname
|
||||
\param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. */
|
||||
struct ast_call_feature *find_feature(char *name);
|
||||
struct ast_call_feature *ast_find_call_feature(char *name);
|
||||
|
||||
#endif /* _AST_FEATURES_H */
|
||||
|
@@ -1055,8 +1055,8 @@ static void ast_unregister_features(void)
|
||||
AST_LIST_UNLOCK(&feature_list);
|
||||
}
|
||||
|
||||
/*! \brief find a feature by name */
|
||||
struct ast_call_feature *find_feature(char *name)
|
||||
/*! \brief find a call feature by name */
|
||||
struct ast_call_feature *ast_find_call_feature(char *name)
|
||||
{
|
||||
struct ast_call_feature *tmp;
|
||||
|
||||
@@ -1197,7 +1197,7 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
|
||||
char *tok;
|
||||
|
||||
while ((tok = strsep(&tmp, "#")) != NULL) {
|
||||
feature = find_feature(tok);
|
||||
feature = ast_find_call_feature(tok);
|
||||
|
||||
if (feature) {
|
||||
/* Feature is up for consideration */
|
||||
@@ -1241,7 +1241,7 @@ static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer,
|
||||
|
||||
/* while we have a feature */
|
||||
while ((tok = strsep(&tmp, "#"))) {
|
||||
if ((feature = find_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
|
||||
if ((feature = ast_find_call_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
|
||||
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLER))
|
||||
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
|
||||
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLEE))
|
||||
@@ -2580,7 +2580,7 @@ static int load_config(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((feature = find_feature(var->name))) {
|
||||
if ((feature = ast_find_call_feature(var->name))) {
|
||||
ast_log(LOG_WARNING, "Dynamic Feature '%s' specified more than once!\n", var->name);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user