Reviewed-by: Steven Dake <sd...@redhat.com> On 01/10/2011 06:26 PM, Angus Salkeld wrote: > Make them all protected by #ifndef timersub > > Signed-off-by: Angus Salkeld <asalk...@redhat.com> > --- > services/pload.c | 21 ++++++++++----------- > test/cpgbench.c | 20 ++++++++++---------- > test/cpgbenchzc.c | 18 +++++++++--------- > tools/corosync-pload.c | 18 ++++++++++-------- > 4 files changed, 39 insertions(+), 38 deletions(-) > > diff --git a/services/pload.c b/services/pload.c > index a378d95..809476f 100644 > --- a/services/pload.c > +++ b/services/pload.c > @@ -333,18 +333,17 @@ static void message_handler_req_exec_pload_start ( > > start_mcasting (); > } > - > #ifndef timersub > -# define timersub(a, b, result) > \ > - do { > \ > - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; > \ > - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; > \ > - if ((result)->tv_usec < 0) { > \ > - --(result)->tv_sec; > \ > - (result)->tv_usec += 1000000; > \ > - } > \ > - } while (0) > -#endif > +#define timersub(a, b, result) \ > +do { \ > + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > + if ((result)->tv_usec < 0) { \ > + --(result)->tv_sec; \ > + (result)->tv_usec += 1000000; \ > + } \ > +} while (0) > +#endif /* timersub */ > > unsigned long long int tv1; > unsigned long long int tv2; > diff --git a/test/cpgbench.c b/test/cpgbench.c > index 9f7be7e..7cb7661 100644 > --- a/test/cpgbench.c > +++ b/test/cpgbench.c > @@ -54,17 +54,17 @@ > #include <corosync/corotypes.h> > #include <corosync/cpg.h> > > -#ifdef COROSYNC_SOLARIS > +#ifndef timersub > #define timersub(a, b, result) > \ > - do { \ > - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > - if ((result)->tv_usec < 0) { \ > - --(result)->tv_sec; \ > - (result)->tv_usec += 1000000; \ > - } \ > - } while (0) > -#endif > + do { \ > + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > + if ((result)->tv_usec < 0) { \ > + --(result)->tv_sec; \ > + (result)->tv_usec += 1000000; \ > + } \ > + } while (0) > +#endif /* timersub */ > > static int alarm_notice; > > diff --git a/test/cpgbenchzc.c b/test/cpgbenchzc.c > index b77d296..93311a0 100644 > --- a/test/cpgbenchzc.c > +++ b/test/cpgbenchzc.c > @@ -54,15 +54,15 @@ > #include <corosync/corotypes.h> > #include <corosync/cpg.h> > > -#ifdef COROSYNC_SOLARIS > -#define timersub(a, b, result) > \ > - do { \ > - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > - if ((result)->tv_usec < 0) { \ > - --(result)->tv_sec; \ > - (result)->tv_usec += 1000000; \ > - } \ > +#ifndef timersub > +#define timersub(a, b, result) \ > + do { \ > + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > + if ((result)->tv_usec < 0) { \ > + --(result)->tv_sec; \ > + (result)->tv_usec += 1000000; \ > + } \ > } while (0) > #endif > > diff --git a/tools/corosync-pload.c b/tools/corosync-pload.c > index 0e2449b..38068bb 100644 > --- a/tools/corosync-pload.c > +++ b/tools/corosync-pload.c > @@ -52,15 +52,17 @@ > #include <corosync/corotypes.h> > #include <corosync/pload.h> > > -#define timersub(a, b, result) > \ > -do { \ > - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > - if ((result)->tv_usec < 0) { \ > - --(result)->tv_sec; \ > - (result)->tv_usec += 1000000; \ > - } \ > +#ifndef timersub > +#define timersub(a, b, result) \ > +do { \ > + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ > + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ > + if ((result)->tv_usec < 0) { \ > + --(result)->tv_sec; \ > + (result)->tv_usec += 1000000; \ > + } \ > } while (0) > +#endif /* timersub */ > > int main (void) { > pload_error_t result;
_______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais