using freep and removing redundant code

This commit is contained in:
Anshul Maheshwari 2014-07-12 19:42:38 +05:30
parent 95e2f7665b
commit 08996a3253
4 changed files with 13 additions and 14 deletions

View File

@ -1,6 +1,7 @@
#include "ccextractor.h"
#include "608_spupng.h"
#include "cc_decoders_common.h"
#include "utility.h"
static const int rowdata[] = {11,-1,1,2,3,4,12,13,14,15,5,6,7,8,9,10};
// Relationship between the first PAC byte and the row number
@ -585,11 +586,8 @@ int write_cc_buffer(struct s_context_cc608 *context)
if (ccx_options.gui_mode_reports)
write_cc_buffer_to_gui(data, context);
data = (struct eia608_screen*)sub->data + 1;
if (sub->data && !sub->size)
{
free(sub->data);
sub->data = NULL;
}
if (!sub->size)
freep(&sub->data);
}
return wrote_something;

View File

@ -188,15 +188,6 @@ static __inline unsigned int get_bits1(GetBitContext *s)
return result;
}
static void freep(void *arg)
{
void **ptr = (void **) arg;
if (*ptr)
free(*ptr);
*ptr = NULL;
}
#ifdef DEBUG
struct transIntensity

View File

@ -336,3 +336,12 @@ int string_cmp(const void *p1,const void *p2)
{
return string_cmp2(p1, p2, NULL);
}
void freep(void *arg)
{
void **ptr = (void **) arg;
if (*ptr)
free(*ptr);
*ptr = NULL;
}

View File

@ -13,5 +13,6 @@
void shell_sort(void *base, int nb,size_t size,int (*compar)(const void*p1,const void *p2,void*arg),void *arg);
int string_cmp(const void *p1,const void *p2);
int string_cmp2(const void *p1,const void *p2,void *arg);
void freep(void *arg);
#endif