From f9ee84a38c62a6ee1eb14836624d498b4fbce0f1 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 4 Jan 2000 17:14:55 +0000 Subject: [PATCH] (EMACS_GET_TIME, EMACS_ADD_TIME, EMACS_SUB_TIME): Give macros statement form. --- src/ChangeLog | 3 +++ src/systime.h | 45 +++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5465c6eda89..532436c95bf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-01-04 Gerd Moellmann + * systime.h (EMACS_GET_TIME, EMACS_ADD_TIME, EMACS_SUB_TIME): Give + macros statement form. + * sound.c (struct sound): Renamed from struct sound_file. (struct sound): Add members `data' and `header_size'. (enum sound_attr): Add SOUND_DATA. diff --git a/src/systime.h b/src/systime.h index a94dc3ed353..7ded857da7e 100644 --- a/src/systime.h +++ b/src/systime.h @@ -95,33 +95,30 @@ extern long timezone; /* On SVR4, the compiler may complain if given this extra BSD arg. */ #ifdef GETTIMEOFDAY_ONE_ARGUMENT -#define EMACS_GET_TIME(time) \ -{ \ - gettimeofday (&(time)); \ -} +#define EMACS_GET_TIME(time) gettimeofday (&(time)) #else /* not GETTIMEOFDAY_ONE_ARGUMENT */ -#define EMACS_GET_TIME(time) \ -{ \ - struct timezone dummy; \ - gettimeofday (&(time), &dummy); \ -} +#define EMACS_GET_TIME(time) \ + do { \ + struct timezone dummy; \ + gettimeofday (&(time), &dummy); \ + } while (0) #endif /* not GETTIMEOFDAY_ONE_ARGUMENT */ -#define EMACS_ADD_TIME(dest, src1, src2) \ -{ \ - (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \ - (dest).tv_usec = (src1).tv_usec + (src2).tv_usec; \ - if ((dest).tv_usec > 1000000) \ - (dest).tv_usec -= 1000000, (dest).tv_sec++; \ -} - -#define EMACS_SUB_TIME(dest, src1, src2) \ -{ \ - (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \ - (dest).tv_usec = (src1).tv_usec - (src2).tv_usec; \ - if ((dest).tv_usec < 0) \ - (dest).tv_usec += 1000000, (dest).tv_sec--; \ -} +#define EMACS_ADD_TIME(dest, src1, src2) \ + do { \ + (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \ + (dest).tv_usec = (src1).tv_usec + (src2).tv_usec; \ + if ((dest).tv_usec > 1000000) \ + (dest).tv_usec -= 1000000, (dest).tv_sec++; \ + } while (0) + +#define EMACS_SUB_TIME(dest, src1, src2) \ + do { \ + (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \ + (dest).tv_usec = (src1).tv_usec - (src2).tv_usec; \ + if ((dest).tv_usec < 0) \ + (dest).tv_usec += 1000000, (dest).tv_sec--; \ + } while (0) #define EMACS_TIME_NEG_P(time) \ ((long)(time).tv_sec < 0 \ -- 2.39.5