fecdec_filter: Simplify clear_group().
authorAndre Noll <maan@systemlinux.org>
Sun, 23 May 2010 17:02:06 +0000 (19:02 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 23 May 2010 17:02:06 +0000 (19:02 +0200)
There is no point in invalidating the index and data pointers if we are about
to free them anyway.  So just set the whole thing to zero. This is easier and
does not require modifications if struct fecdec_group changes.

fecdec_filter.c

index 10f1c642034c9457af12e6c23a1450bbf5eb3245..195dbaae1814d08316df54cf0597c914c6c1abd9 100644 (file)
@@ -102,18 +102,11 @@ static void clear_group(struct fecdec_group *fg)
 {
        int i;
 
 {
        int i;
 
-       for (i = 0; i < fg->num_slices; i++) {
+       for (i = 0; i < fg->num_slices; i++)
                free(fg->data[i]);
                free(fg->data[i]);
-               fg->data[i] = NULL;
-               fg->idx[i] = -1;
-       }
        free(fg->data);
        free(fg->data);
-       fg->data = NULL;
        free(fg->idx);
        free(fg->idx);
-       fg->idx = NULL;
-       fg->num_slices = 0;
-       memset(&fg->h, 0, sizeof(struct fec_header));
-       fg->num_received_slices = 0;
+       memset(fg, 0, sizeof(*fg));
 }
 
 static int find_group(struct fec_header *h,
 }
 
 static int find_group(struct fec_header *h,