re-arranged mode checking code in codec2_create, thanks Alex
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 22 Nov 2015 21:02:41 +0000 (21:02 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 22 Nov 2015 21:02:41 +0000 (21:02 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2494 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/codec2.c

index d9ed51c8980629b39c5a79a1b44c801dd9ac1586..eed45a95f0a021d91fbda42141e5ec8da9618918 100644 (file)
@@ -100,12 +100,9 @@ struct CODEC2 * codec2_create(int mode)
     struct CODEC2 *c2;
     int            i,l;
 
-    c2 = (struct CODEC2*)malloc(sizeof(struct CODEC2));
-    if (c2 == NULL)
-       return NULL;
-
     if ((mode != CODEC2_MODE_3200) &&
           (mode != CODEC2_MODE_2400) &&
+          (mode != CODEC2_MODE_1600) &&
           (mode != CODEC2_MODE_1400) &&
           (mode != CODEC2_MODE_1300) &&
           (mode != CODEC2_MODE_1200) &&
@@ -115,6 +112,10 @@ struct CODEC2 * codec2_create(int mode)
         return NULL;
     }
 
+    c2 = (struct CODEC2*)malloc(sizeof(struct CODEC2));
+    if (c2 == NULL)
+       return NULL;
+
     c2->mode = mode;
     for(i=0; i<M; i++)
        c2->Sn[i] = 1.0;