1 /* plugin.c -- generic plugin routines for vlock,
2 * the VT locking program for linux
4 * This program is copyright (C) 2007 Frank Benkstein, and is free
5 * software which is freely distributable under the terms of the
6 * GNU General Public License version 2, included as the file COPYING in this
7 * distribution. It is NOT public domain software, and any
8 * redistribution not permitted by the GNU General Public License is
9 * expressly forbidden without prior written permission from
22 /* Allocate a new plugin struct. */
23 struct plugin
*__allocate_plugin(const char *name
)
25 struct plugin
*p
= ensure_malloc(sizeof *p
);
27 p
->name
= strdup(name
);
28 p
->save_disabled
= false;
30 for (size_t i
= 0; i
< nr_dependencies
; i
++)
31 p
->dependencies
[i
] = list_new();
36 /* Destroy the given plugin. (Internal version.) */
37 void __destroy_plugin(struct plugin
*p
)
39 for (size_t i
= 0; i
< nr_dependencies
; i
++) {
40 list_delete_for_each(p
->dependencies
[i
], dependency_item
)
41 free(dependency_item
->data
);
43 list_free(p
->dependencies
[i
]);
50 /* Destroy the given plugin. (External version.) */
51 void destroy_plugin(struct plugin
*p
)