From 5a1de68b9a2e0ae7b92c741d2d041e7f290899e7 Mon Sep 17 00:00:00 2001 From: Richard Mudgett <rmudgett@digium.com> Date: Fri, 5 Sep 2014 17:45:03 +0000 Subject: [PATCH] devicestate.c: Minor tweaks * In ast_state_chan2dev() use ARRAY_LEN() instead of a sentinel value in chan2dev[]. * Fix some comments in chan_iax2.c. ........ Merged revisions 422661 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422663 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 9 +++++---- main/devicestate.c | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index a41f173b9b..1f37904d07 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5036,7 +5036,7 @@ reject: * password field will be set to NULL. * * \note The dial string format is: - * [username[:password]@]peer[:port][/exten[@@context]][/options] + * [username[:password]@]peer[:port][/exten[@context]][/options] */ static void parse_dial_string(char *data, struct parsed_dial_string *pds) { @@ -5069,9 +5069,10 @@ static void parse_dial_string(char *data, struct parsed_dial_string *pds) pds->peer = strsep(&data, ":"); pds->port = data; - /* check for a key name wrapped in [] in the secret position, if found, - move it to the key field instead - */ + /* + * Check for a key name wrapped in [] in the password position. + * If found, move it to the key field instead. + */ if (pds->password && (pds->password[0] == '[')) { pds->key = ast_strip_quoted(pds->password, "[", "]"); pds->password = NULL; diff --git a/main/devicestate.c b/main/devicestate.c index 7f9136da39..7eb9e3057d 100644 --- a/main/devicestate.c +++ b/main/devicestate.c @@ -169,7 +169,7 @@ static const char * const devstatestring[][2] = { { /* 5 AST_DEVICE_UNAVAILABLE */ "Unavailable", "UNAVAILABLE" }, /*!< Unavailable (not registered) */ { /* 6 AST_DEVICE_RINGING */ "Ringing", "RINGING" }, /*!< Ring, ring, ring */ { /* 7 AST_DEVICE_RINGINUSE */ "Ring+Inuse", "RINGINUSE" }, /*!< Ring and in use */ - { /* 8 AST_DEVICE_ONHOLD */ "On Hold", "ONHOLD" }, /*!< On Hold */ + { /* 8 AST_DEVICE_ONHOLD */ "On Hold", "ONHOLD" }, /*!< On Hold */ }; /*!\brief Mapping for channel states to device states */ @@ -187,7 +187,6 @@ static const struct chan2dev { { AST_STATE_BUSY, AST_DEVICE_BUSY }, { AST_STATE_DIALING_OFFHOOK, AST_DEVICE_INUSE }, { AST_STATE_PRERING, AST_DEVICE_RINGING }, - { -100, -100 }, }; /*! \brief A device state provider (not a channel) */ @@ -251,7 +250,7 @@ enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate) { int i; chanstate &= 0xFFFF; - for (i = 0; chan2dev[i].chan != -100; i++) { + for (i = 0; i < ARRAY_LEN(chan2dev); i++) { if (chan2dev[i].chan == chanstate) { return chan2dev[i].dev; } -- GitLab