]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use the linkedlists.h AST_LIST_NEXT macro for modifying the list of results.
authorJoshua Colp <jcolp@digium.com>
Wed, 11 Jul 2007 17:34:30 +0000 (17:34 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 11 Jul 2007 17:34:30 +0000 (17:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@74616 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_speech_utils.c
include/asterisk/speech.h
res/res_speech.c

index 2df89ba4e26cdcb64ba88a52cdee06a731d20bc7..30d1737f3c44f67d529fe72af43af98036536640 100644 (file)
@@ -150,7 +150,7 @@ static struct ast_speech_result *find_result(struct ast_speech_result *results,
                if (i == wanted_num)
                        break;
                i++;
-       } while ((result = result->next));
+       } while ((result = AST_LIST_NEXT(result, list)));
 
        return result;
 }
@@ -315,11 +315,8 @@ static int speech_read(struct ast_channel *chan, const char *cmd, char *data,
                        ast_copy_string(buf, "0", len);
        } else if (!strcasecmp(data, "results")) {
                /* Count number of results */
-               result = speech->results;
-               while (result) {
+               for (result = speech->results; result; result = AST_LIST_NEXT(result, list))
                        results++;
-                       result = result->next;
-               }
                snprintf(tmp, sizeof(tmp), "%d", results);
                ast_copy_string(buf, tmp, len);
        }
index 81b45a7618d36bcff67794f24113887f1fe917ce..02d056f336ea59662b4c0fdeedb0aa0a3fbcefd5 100644 (file)
@@ -110,7 +110,7 @@ struct ast_speech_result {
        /*! Matched grammar */
        char *grammar;
        /*! List information */
-       struct ast_speech_result *next;
+       AST_LIST_ENTRY(ast_speech_result) list;
 };
 
 /*! \brief Activate a grammar on a speech structure */
index e848b06cae72bfc45e591844e60576e4c32444b3..9047ad254d7f689f16b8ebf931a9f9d37ac3b5c5 100644 (file)
@@ -113,7 +113,7 @@ int ast_speech_results_free(struct ast_speech_result *result)
                        current_result->grammar = NULL;
                }
                /* Move on and then free ourselves */
-               current_result = current_result->next;
+               current_result = AST_LIST_NEXT(current_result, list);
                ast_free(prev_result);
                prev_result = NULL;
        }