I dunno what that does, but if it works, then i'm satisified :) Regards -steve On Thu, 2009-04-23 at 13:32 +0200, Jim Meyering wrote: > Steven Dake wrote: > > _logsys_log_printf should duplicate the code in logsys_log_vprintf and > > not call logsys_log_vprintf directly. This api is called hundreds of > > thousands of times in a 1-2 minute run and as is can consume 1.5% of the > > cpu utilization. I don't want to make it worse. > > Requiring copy/paste. Urgh. > Normally I ignore the "this single additional function call might > be expensive" argument, unless it is accompanied by profiling results. > > However, here I'll presume you know what you're talking about > and propose the following, to ensure the copies never diverge. > > With this tiny rule, "make check" will now ensure that those > two functions remain essentially identical. I.e., if one is > changed, the other must be changed in exactly the same way, > comments included. > > Jim > > From 69ca9adb6775772d37626548a9eef8c4d0d37f80 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <[email protected]> > Date: Thu, 23 Apr 2009 13:25:46 +0200 > Subject: [PATCH] exec/Makefile.am: require that copied code stays in sync > > * exec/Makefile.am (check_logsys_log_printf_functions): New rule. > (check): Depend on check_logsys_log_printf_functions. > --- > exec/Makefile.am | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/exec/Makefile.am b/exec/Makefile.am > index 38104d4..4b1abba 100644 > --- a/exec/Makefile.am > +++ b/exec/Makefile.am > @@ -135,3 +135,14 @@ uninstall-local: > > clean-local: > rm -f corosync *.o *.lcrso gmon.out *.da *.bb *.bbg *.so* > + > +# Since we're requiring that _logsys_log_printf and _logsys_log_vprintf > +# have nearly identical code, here we require that they stay in sync. > +check_logsys_log_printf_functions: > + $(AWK) '/^void _logsys_log_printf \(/, /^}/' $(srcdir)/logsys.c \ > + | sed '/^[ ]*va_/d;s/\.\.\.)$$/va_list ap)/' > $...@-1 > + $(AWK) '/^void _logsys_log_vprintf \(/, /^}/' $(srcdir)/logsys.c \ > + | sed 's/log_vprintf/log_printf/' > $...@-2 > + diff $...@-1 $...@-2 && rm -f $...@-1 $...@-2 > + > +check: check_logsys_log_printf_functions > -- > 1.6.3.rc1.205.g37f8
_______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
