~mdoyen/homebank/5.2.x

« back to all changes in this revision

Viewing changes to src/hb-archive.c

  • Committer: Maxime Doyen
  • Date: 2019-07-29 20:34:22 UTC
  • Revision ID: homebank@free.fr-20190729203422-hy3g4szjv3dbzmxu
5.2.7 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
extern struct HomeBank *GLOBALS;
37
37
 
38
38
 
 
39
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
 
40
 
 
41
 
 
42
static void
 
43
da_archive_clean(Archive *item)
 
44
{
 
45
        if(item != NULL)
 
46
        {
 
47
                if(item->memo != NULL)
 
48
                {
 
49
                        g_free(item->memo);
 
50
                        item->memo = NULL;
 
51
                }
 
52
 
 
53
 
 
54
 
 
55
 
 
56
 
 
57
                //5.3 added as it was a leak
 
58
                if(item->tags != NULL)
 
59
                {
 
60
                        g_free(item->tags);
 
61
                        item->tags = NULL;
 
62
                }
 
63
                if(item->splits != NULL)
 
64
                {
 
65
                        da_split_destroy(item->splits);
 
66
                        item->splits = NULL;
 
67
                        item->flags &= ~(OF_SPLIT); //Flag that Splits are cleared
 
68
                }
 
69
        }
 
70
}
 
71
 
 
72
 
 
73
void da_archive_free(Archive *item)
 
74
{
 
75
        if(item != NULL)
 
76
        {
 
77
                da_archive_clean(item);
 
78
                g_free(item);
 
79
        }
 
80
}
 
81
 
 
82
 
39
83
Archive *da_archive_malloc(void)
40
84
{
41
85
Archive *item;
69
113
}
70
114
 
71
115
 
72
 
void da_archive_free(Archive *item)
73
 
{
74
 
        if(item != NULL)
75
 
        {
76
 
                if(item->memo != NULL)
77
 
                        g_free(item->memo);
78
 
                if(item->splits != NULL)
79
 
                        da_split_destroy(item->splits);
80
 
                g_free(item);
81
 
        }
82
 
}
83
 
 
84
 
 
85
116
void da_archive_destroy(GList *list)
86
117
{
87
118
GList *tmplist = g_list_first(list);