reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
|
|
@ -5,8 +5,7 @@
|
|||
#include "hook.h"
|
||||
#include "utils.h"
|
||||
|
||||
int xce_hook_init(hooksys_t* s,
|
||||
int maxtypes)
|
||||
int xce_hook_init(hooksys_t* s, int maxtypes)
|
||||
{
|
||||
int i;
|
||||
if ((s == NULL) || (maxtypes <= 0)) {
|
||||
|
|
@ -26,10 +25,7 @@ int xce_hook_init(hooksys_t* s,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int xce_add_hook(hooksys_t* s,
|
||||
int typ,
|
||||
hook_fn_t fn,
|
||||
void* data)
|
||||
int xce_add_hook(hooksys_t* s, int typ, hook_fn_t fn, void* data)
|
||||
{
|
||||
hook_item_t* it;
|
||||
|
||||
|
|
@ -62,11 +58,7 @@ int xce_add_hook(hooksys_t* s,
|
|||
* negative value will cause
|
||||
* fail
|
||||
*/
|
||||
int xce_run_hooks(hooksys_t* s,
|
||||
int type,
|
||||
int situation,
|
||||
int detail,
|
||||
...)
|
||||
int xce_run_hooks(hooksys_t* s, int type, int situation, int detail, ...)
|
||||
{
|
||||
xlist_t* l;
|
||||
int i;
|
||||
|
|
@ -91,8 +83,7 @@ int xce_run_hooks(hooksys_t* s,
|
|||
}
|
||||
|
||||
va_start(ap, detail);
|
||||
rc = (*(it->fn))(type, situation, detail,
|
||||
it->data, ap);
|
||||
rc = (*(it->fn))(type, situation, detail, it->data, ap);
|
||||
va_end(ap);
|
||||
|
||||
if ((situation == HOOK_BEFORE_EVENT) && (rc < 0)) {
|
||||
|
|
@ -103,8 +94,7 @@ int xce_run_hooks(hooksys_t* s,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int free_hook_item(void* data1,
|
||||
void* data2)
|
||||
static int free_hook_item(void* data1, void* data2)
|
||||
{
|
||||
if (data1 == NULL) {
|
||||
return -EINVAL;
|
||||
|
|
@ -127,9 +117,7 @@ void xce_hook_fini(hooksys_t* s)
|
|||
}
|
||||
|
||||
for (i = 0; i < s->maxtypes; i++) {
|
||||
xlist_iter(&(s->hooks[i]),
|
||||
(xlist_iter_fn_t)free_hook_item,
|
||||
NULL);
|
||||
xlist_iter(&(s->hooks[i]), (xlist_iter_fn_t)free_hook_item, NULL);
|
||||
xlist_fini(&(s->hooks[i]));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue