Make callout_setfunc() a CPP macro. Suggested by enami.

This commit is contained in:
thorpej 2003-10-30 04:32:56 +00:00
parent 3c59c821ae
commit 67f69c1c63
2 changed files with 9 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_timeout.c,v 1.12 2003/10/27 16:52:01 thorpej Exp $ */
/* $NetBSD: kern_timeout.c,v 1.13 2003/10/30 04:32:56 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.12 2003/10/27 16:52:01 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.13 2003/10/30 04:32:56 thorpej Exp $");
/*
* Adapted from OpenBSD: kern_timeout.c,v 1.15 2002/12/08 04:21:07 art Exp,
@ -226,22 +226,6 @@ callout_init(struct callout *c)
memset(c, 0, sizeof(*c));
}
/*
* callout_setfunc:
*
* Initialize a callout structure and set the function and
* argument.
*
* NOTE: THE CALLOUT STRUCTURE MUST ALREADY BE INITIALIZED!
*/
void
callout_setfunc(struct callout *c, void (*func)(void *), void *arg)
{
c->c_func = func;
c->c_arg = arg;
}
/*
* callout_reset:
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: callout.h,v 1.19 2003/09/25 10:44:11 scw Exp $ */
/* $NetBSD: callout.h,v 1.20 2003/10/30 04:32:56 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@ -115,6 +115,12 @@ void callout_schedule(struct callout *, int);
void callout_stop(struct callout *);
int callout_hardclock(void);
#define callout_setfunc(c, f, a) \
do { \
(c)->c_func = (f); \
(c)->c_arg = (a); \
} while (/*CONSTCOND*/0)
#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)
#define callout_expired(c) ((c)->c_flags & CALLOUT_FIRED)
#define callout_invoking(c) ((c)->c_flags & CALLOUT_INVOKING)