diff options
Diffstat (limited to 'apps/codecs/dumb/src/core/unload.c')
-rw-r--r-- | apps/codecs/dumb/src/core/unload.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/apps/codecs/dumb/src/core/unload.c b/apps/codecs/dumb/src/core/unload.c new file mode 100644 index 0000000000..3bf0285cd1 --- /dev/null +++ b/apps/codecs/dumb/src/core/unload.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* _______ ____ __ ___ ___ | ||
2 | * \ _ \ \ / \ / \ \ / / ' ' ' | ||
3 | * | | \ \ | | || | \/ | . . | ||
4 | * | | | | | | || ||\ /| | | ||
5 | * | | | | | | || || \/ | | ' ' ' | ||
6 | * | | | | | | || || | | . . | ||
7 | * | |_/ / \ \__// || | | | ||
8 | * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque | ||
9 | * / \ | ||
10 | * / . \ | ||
11 | * unload.c - Code to free a DUH from memory. / / \ \ | ||
12 | * | < / \_ | ||
13 | * By entheh. | \/ /\ / | ||
14 | * \_ / > / | ||
15 | * | \ / / | ||
16 | * | ' / | ||
17 | * \__/ | ||
18 | */ | ||
19 | |||
20 | #include <stdlib.h> | ||
21 | |||
22 | #include "dumb.h" | ||
23 | #include "internal/dumb.h" | ||
24 | |||
25 | |||
26 | |||
27 | static void destroy_signal(DUH_SIGNAL *signal) | ||
28 | { | ||
29 | if (signal) { | ||
30 | if (signal->desc) | ||
31 | if (signal->desc->unload_sigdata) | ||
32 | if (signal->sigdata) | ||
33 | (*signal->desc->unload_sigdata)(signal->sigdata); | ||
34 | |||
35 | free(signal); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | |||
40 | |||
41 | /* unload_duh(): destroys a DUH struct. You must call this for every DUH | ||
42 | * struct created, when you've finished with it. | ||
43 | */ | ||
44 | void unload_duh(DUH *duh) | ||
45 | { | ||
46 | int i; | ||
47 | |||
48 | if (duh) { | ||
49 | if (duh->signal) { | ||
50 | for (i = 0; i < duh->n_signals; i++) | ||
51 | destroy_signal(duh->signal[i]); | ||
52 | |||
53 | free(duh->signal); | ||
54 | } | ||
55 | |||
56 | free(duh); | ||
57 | } | ||
58 | } | ||