Fix some opaquification-related compiler warnings
authorTerry Wilson <twilson@digium.com>
Tue, 21 Feb 2012 20:17:52 +0000 (20:17 +0000)
committerTerry Wilson <twilson@digium.com>
Tue, 21 Feb 2012 20:17:52 +0000 (20:17 +0000)
(closes issue ASTERISK-19419)
PseudoReview - seanbright on IRC

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356152 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c
main/framehook.c
res/res_monitor.c

index a7cca1c..a5cb641 100644 (file)
@@ -2926,7 +2926,7 @@ static int generator_force(const void *data)
 int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
 {
        int res = 0;
-       void *generatordata;
+       void *generatordata = NULL;
 
        ast_channel_lock(chan);
        if (ast_channel_generatordata(chan)) {
@@ -2937,10 +2937,12 @@ int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen,
        if (gen->alloc && !(generatordata = gen->alloc(chan, params))) {
                res = -1;
        }
+       if (generatordata) {
+               ast_channel_generator_set(chan, gen);
+       }
        if (!res) {
                ast_settimeout(chan, 50, generator_force, chan);
                ast_channel_generatordata_set(chan, generatordata);
-               ast_channel_generator_set(chan, gen);
        }
        ast_channel_unlock(chan);
 
index 14f6198..67d5584 100644 (file)
@@ -104,12 +104,14 @@ int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interfac
        framehook->chan = chan;
 
        /* create the framehook list if it didn't already exist */
-       if (!ast_channel_framehooks(chan) && !(fh_list = ast_calloc(1, sizeof(*ast_channel_framehooks(chan))))) {
-               ast_free(framehook);
-               return -1;
+       if (!ast_channel_framehooks(chan)) {
+               if (!(fh_list = ast_calloc(1, sizeof(*ast_channel_framehooks(chan))))) {
+                       ast_free(framehook);
+                       return -1;
+               }
+               ast_channel_framehooks_set(chan, fh_list);
        }
 
-       ast_channel_framehooks_set(chan, fh_list);
        framehook->id = ++ast_channel_framehooks(chan)->id_count;
        AST_LIST_INSERT_TAIL(&ast_channel_framehooks(chan)->list, framehook, list);
 
index 045fa6a..5482f54 100644 (file)
@@ -689,11 +689,13 @@ static int start_monitor_exec(struct ast_channel *chan, const char *data)
                snprintf(tmp, sizeof(tmp), "%s/%s.%s", urlprefix, args.fname_base,
                        ((strcmp(args.format, "gsm")) ? "wav" : "gsm"));
                ast_channel_lock(chan);
-               if (!ast_channel_cdr(chan) && !(chan_cdr = ast_cdr_alloc())) {
-                       ast_channel_unlock(chan);
-                       return -1;
+               if (!ast_channel_cdr(chan)) {
+                       if (!(chan_cdr = ast_cdr_alloc())) {
+                               ast_channel_unlock(chan);
+                               return -1;
+                       }
+                       ast_channel_cdr_set(chan, chan_cdr);
                }
-               ast_channel_cdr_set(chan, chan_cdr);
                ast_cdr_setuserfield(chan, tmp);
                ast_channel_unlock(chan);
        }