From 05316edf7b9359bc9b9355e6b677bd2ee204f185 Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 30 Jun 2007 13:15:33 +0000 Subject: [PATCH] Use verify_true for validating constant conditions rather than assert, because the latter is only checked at runtime and eats CPU time --- ChangeLog | 4 ++++ find/pred.c | 3 ++- xargs/xargs.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4155787..4b530f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-06-30 James Youngman + * find/pred.c (format_date): Use verify_true for constant + conditions rather than assert. + * xargs/xargs.c (main): Ditto. + Enhancements to the code smell detector. * Makefile.am (findutils-check-smells): Automate the calling of build-aux/src-sniff.py. diff --git a/find/pred.c b/find/pred.c index d043d11..fc29f2d 100644 --- a/find/pred.c +++ b/find/pred.c @@ -47,6 +47,7 @@ #include "stat-time.h" #include "dircallback.h" #include "error.h" +#include "verify.h" #if ENABLE_NLS # include @@ -2025,7 +2026,7 @@ format_date (struct timespec ts, int kind) * demonstrating that the performance difference is actually * measurable. */ - assert (sizeof(buf) >= LONGEST_HUMAN_READABLE); + verify_true (sizeof(buf) >= LONGEST_HUMAN_READABLE); charsprinted = 0; need_ns_suffix = 0; diff --git a/xargs/xargs.c b/xargs/xargs.c index b6d9186..d7dfe81 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -96,6 +96,7 @@ #define SIGCHLD SIGCLD #endif +#include "verify.h" #include "wait.h" #include "quotearg.h" @@ -680,7 +681,7 @@ main (int argc, char **argv) /* Without SIZE_MAX (i.e. limits.h) this is probably * close to the best we can do. */ - assert (sizeof(size_t) <= sizeof(unsigned long)); + verify_true (sizeof(size_t) <= sizeof(unsigned long)); #endif if (show_limits) -- 2.11.4.GIT