Wrap two macros into do { ... } while (0), and fix the way they're used

in the kernel.

Reviewed by: bde
This commit is contained in:
Dag-Erling Smørgrav 1998-12-15 17:38:33 +00:00
parent 37fcb38764
commit e3b3ba2d79
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41827
4 changed files with 26 additions and 22 deletions

View File

@ -46,7 +46,7 @@
* in Germany will I accept domestic beer. This code may or may not work
* and I certainly make no claims as to its fitness for *any* purpose.
*
* $Id: kern_threads.c,v 1.8 1998/06/02 05:39:11 dyson Exp $
* $Id: kern_threads.c,v 1.9 1998/10/25 17:44:51 phk Exp $
*/
#include <sys/param.h>
@ -86,7 +86,7 @@ thr_sleep(struct proc *p, struct thr_sleep_args *uap) {
p->p_wakeup = 0;
return (EINVAL);
}
TIMESPEC_TO_TIMEVAL(&atv, &ts)
TIMESPEC_TO_TIMEVAL(&atv, &ts);
if (itimerfix(&atv)) {
p->p_wakeup = 0;
return (EINVAL);

View File

@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
* $Id: vfs_aio.c,v 1.34 1998/10/25 17:44:52 phk Exp $
* $Id: vfs_aio.c,v 1.35 1998/11/27 01:14:21 tegge Exp $
*/
/*
@ -1478,7 +1478,7 @@ aio_suspend(struct proc *p, struct aio_suspend_args *uap)
if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
return (EINVAL);
TIMESPEC_TO_TIMEVAL(&atv, &ts)
TIMESPEC_TO_TIMEVAL(&atv, &ts);
if (itimerfix(&atv))
return (EINVAL);
timo = tvtohz(&atv);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* $Id: time.h,v 1.33 1998/06/09 13:10:54 phk Exp $
* $Id: time.h,v 1.34 1998/10/23 10:42:42 phk Exp $
*/
#ifndef _SYS_TIME_H_
@ -56,14 +56,16 @@ struct timespec {
};
#endif
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
#define TIMEVAL_TO_TIMESPEC(tv, ts) \
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
} while (0)
#define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
} while (0)
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* $Id: time.h,v 1.33 1998/06/09 13:10:54 phk Exp $
* $Id: time.h,v 1.34 1998/10/23 10:42:42 phk Exp $
*/
#ifndef _SYS_TIME_H_
@ -56,14 +56,16 @@ struct timespec {
};
#endif
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
#define TIMEVAL_TO_TIMESPEC(tv, ts) \
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
} while (0)
#define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
} while (0)
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */