Commit 28b91058 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Pass VUTs to callbacks

With the exception of dispatch_f that already has a dispatch_priv.
parent f3e67485
......@@ -366,8 +366,9 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
}
static int __match_proto__(VUT_cb_f)
sighup(void)
sighup(struct VUT *v)
{
assert(v == &VUT);
quit = 1;
return (1);
}
......
......@@ -87,9 +87,10 @@ openout(int append)
}
static int __match_proto__(VUT_cb_f)
rotateout(void)
rotateout(struct VUT *v)
{
assert(v == &VUT);
AN(LOG.w_arg);
AN(LOG.fo);
fclose(LOG.fo);
......@@ -99,9 +100,11 @@ rotateout(void)
}
static int __match_proto__(VUT_cb_f)
flushout(void)
flushout(struct VUT *v)
{
if (v != NULL)
assert(v == &VUT);
AN(LOG.fo);
if (fflush(LOG.fo))
return (-5);
......@@ -109,8 +112,9 @@ flushout(void)
}
static int __match_proto__(VUT_cb_f)
sighup(void)
sighup(struct VUT *v)
{
assert(v == &VUT);
return (1);
}
......@@ -177,7 +181,7 @@ main(int argc, char * const *argv)
VUT_Main();
VUT_Fini();
(void)flushout();
(void)flushout(NULL);
exit(0);
}
......@@ -183,9 +183,10 @@ openout(int append)
}
static int __match_proto__(VUT_cb_f)
rotateout(void)
rotateout(struct VUT *v)
{
assert(v == &VUT);
AN(CTX.w_arg);
AN(CTX.fo);
fclose(CTX.fo);
......@@ -195,9 +196,10 @@ rotateout(void)
}
static int __match_proto__(VUT_cb_f)
flushout(void)
flushout(struct VUT *v)
{
assert(v == &VUT);
AN(CTX.fo);
if (fflush(CTX.fo))
return (-5);
......@@ -1104,8 +1106,9 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
}
static int __match_proto__(VUT_cb_f)
sighup(void)
sighup(struct VUT *v)
{
assert(v == &VUT);
return (1);
}
......
......@@ -178,8 +178,9 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
}
static int __match_proto__(VUT_cb_f)
sighup(void)
sighup(struct VUT *v)
{
assert(v == &VUT);
quit = 1;
return (1);
}
......
......@@ -29,10 +29,11 @@
* Common functions for the utilities
*/
struct VUT;
struct vopt_spec;
typedef void VUT_sighandler_f(int);
typedef int VUT_cb_f(void);
typedef int VUT_cb_f(struct VUT *);
struct VUT {
const char *progname;
......
......@@ -324,7 +324,7 @@ VUT_Main(void)
if (VUT.sighup && VUT.sighup_f) {
/* sighup callback */
VUT.sighup = 0;
i = VUT.sighup_f();
i = VUT.sighup_f(&VUT);
if (i)
break;
}
......@@ -370,7 +370,7 @@ VUT_Main(void)
else if (i == 0) {
/* Nothing to do but wait */
if (VUT.idle_f) {
i = VUT.idle_f();
i = VUT.idle_f(&VUT);
if (i)
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment