2007-06-26 James Youngman
* build-aux/src-sniff.py: Detect uses of struct stat where the
header file was not included.
* find/find.c: Fix this, and uses of assert without a following
space (the coding standard requires a space, but there are still
a number of cases where other functions are called with no
following space).
* find/fstype.c: Ditto.
* find/ftsfind.c: Ditto.
* find/parser.c: Ditto.
* find/pred.c: Ditto.
* find/tree.c: Ditto.
* find/util.c: Ditto.
* lib/buildcmd.c: Ditto.
* lib/buildcmd.h: Ditto.
* lib/extendbuf.c: Ditto.
* locate/frcode.c: Ditto.
* locate/locate.c: Ditto.
* locate/word_io.c: Ditto.
* xargs/xargs.c: Ditto.
* find/tree.c (cost_table_comparison): Avoid < comparison between
function pointer types. Instead cast the function pointers to
(const void*). Both alternatives are undefined C, but the former
actually fails to compile on some systems. This fixes Savannah
bug #20263.
* NEWS: mention the fix
* find/tree.c (calculate_derived_rates): Removed assignment to
rate variable following an assert(0) call, which had been added to
silence a "used before initialised" warning, and replace it with a
call to abort, which (a) correctly halts execution if _NDEBUG is
defined and (b) more accurately documents what's happening.
* find/parser.c (get_stat_Ytime): Removed redundant call to abort.
* find/util.c (debug_stat): For consistency, use assert (0) rather
than assert (false).
Index: ChangeLog
===================================================================
RCS file: /sources/findutils/findutils/ChangeLog,v
retrieving revision 1.223
diff -u -p -r1.223 ChangeLog
--- ChangeLog 26 Jun 2007 07:24:48 -0000 1.223
+++ ChangeLog 26 Jun 2007 08:21:33 -0000
@@ -1,5 +1,45 @@
2007-06-26 James Youngman
+ * build-aux/src-sniff.py: Detect uses of struct stat where the
+ header file was not included.
+ * find/find.c: Fix this, and uses of assert without a following
+ space (the coding standard requires a space, but there are still
+ a number of cases where other functions are called with no
+ following space).
+ * find/fstype.c: Ditto.
+ * find/ftsfind.c: Ditto.
+ * find/parser.c: Ditto.
+ * find/pred.c: Ditto.
+ * find/tree.c: Ditto.
+ * find/util.c: Ditto.
+ * lib/buildcmd.c: Ditto.
+ * lib/buildcmd.h: Ditto.
+ * lib/extendbuf.c: Ditto.
+ * locate/frcode.c: Ditto.
+ * locate/locate.c: Ditto.
+ * locate/word_io.c: Ditto.
+ * xargs/xargs.c: Ditto.
+
+ * find/tree.c (cost_table_comparison): Avoid < comparison between
+ function pointer types. Instead cast the function pointers to
+ (const void*). Both alternatives are undefined C, but the former
+ actually fails to compile on some systems. This fixes Savannah
+ bug #20263.
+ * NEWS: mention the fix
+
+ * find/tree.c (calculate_derived_rates): Removed assignment to
+ rate variable following an assert(0) call, which had been added to
+ silence a "used before initialised" warning, and replace it with a
+ call to abort, which (a) correctly halts execution if _NDEBUG is
+ defined and (b) more accurately documents what's happening.
+
+ * find/parser.c (get_stat_Ytime): Removed redundant call to abort.
+
+ * find/util.c (debug_stat): For consistency, use assert (0) rather
+ than assert (false).
+
+2007-06-26 James Youngman
+
* README-alpha: Mention the findutils-patches mailng list and the
archives for findutils-patches and bug-findutils.
Index: NEWS
===================================================================
RCS file: /sources/findutils/findutils/NEWS,v
retrieving revision 1.186
diff -u -p -r1.186 NEWS
--- NEWS 24 Jun 2007 16:37:31 -0000 1.186
+++ NEWS 26 Jun 2007 08:21:33 -0000
@@ -2,6 +2,8 @@ GNU findutils NEWS - User visible change
* Major changes in release 4.3.9-CVS
** Bug Fixes
+#20263: Compilation fix for DEC Alpha OSF/1 cc, which forbids the
+ordering comparison of function pointers.
#20139: find -[acm]time -N (wrongly) includes files from N days ago,
as well as (correctly) from less than N days ago.
Index: build-aux/src-sniff.py
===================================================================
RCS file: /sources/findutils/findutils/build-aux/src-sniff.py,v
retrieving revision 1.2
diff -u -p -r1.2 src-sniff.py
--- build-aux/src-sniff.py 21 Jun 2007 23:41:04 -0000 1.2
+++ build-aux/src-sniff.py 26 Jun 2007 08:21:33 -0000
@@ -58,6 +58,21 @@ def BuildIncludeList(text):
return [m.group(1) for m in include_re.finditer(text)]
+def CheckStatHeader(filename, lines, fulltext):
+ stat_hdr_re = re.compile(r'# *include .*')
+ # It's OK to have a pointer though.
+ stat_use_re = re.compile(r'struct stat\W *[^*]')
+ for line in lines:
+ m = stat_use_re.search(line[1])
+ if m:
+ msgfmt = "%d: If you use struct stat, you must #include first"
+ Problem(filename, msgfmt % line[0])
+ # Diagnose only once
+ break
+ m = stat_hdr_re.search(line[1])
+ if m:
+ break
+
def CheckFirstInclude(filename, lines, fulltext):
includes = BuildIncludeList(fulltext)
if includes and includes[0] != FIRST_INCLUDE:
@@ -88,7 +103,8 @@ def CheckFileSmells(filename, lines, ful
def SniffSourceFile(filename, lines, fulltext):
- for sniffer in [CheckFirstInclude, CheckLineSmells, CheckFileSmells]:
+ for sniffer in [CheckFirstInclude, CheckStatHeader,
+ CheckLineSmells, CheckFileSmells]:
sniffer(filename, lines, fulltext)
Index: find/find.c
===================================================================
RCS file: /sources/findutils/findutils/find/find.c,v
retrieving revision 1.119
diff -u -p -r1.119 find.c
--- find/find.c 21 Jun 2007 23:41:05 -0000 1.119
+++ find/find.c 26 Jun 2007 08:21:33 -0000
@@ -37,7 +37,7 @@
#include
#include
-
+#include
#ifdef HAVE_FCNTL_H
#include
#else
@@ -198,7 +198,7 @@ main (int argc, char **argv)
close (starting_desc);
starting_desc = -1;
}
- assert(starting_desc >= 0);
+ assert (starting_desc >= 0);
if (starting_desc < 0)
{
@@ -294,8 +294,8 @@ static size_t num_mounted_devices = 0u;
static void
init_mounted_dev_list(int mandatory)
{
- assert(NULL == mounted_devices);
- assert(0 == num_mounted_devices);
+ assert (NULL == mounted_devices);
+ assert (0 == num_mounted_devices);
mounted_devices = get_mounted_devices(&num_mounted_devices);
if (mandatory && (NULL == mounted_devices))
{
@@ -779,7 +779,7 @@ safely_chdir_lstat(const char *dest,
}
*did_stat = statflag;
- assert(rv_set);
+ assert (rv_set);
return rv;
}
@@ -1282,7 +1282,7 @@ process_dir (char *pathname, char *name,
if (dirinfo == NULL)
{
- assert(errno != 0);
+ assert (errno != 0);
error (0, errno, "%s", safely_quote_err_filename(0, pathname));
state.exit_status = 1;
}
@@ -1509,6 +1509,6 @@ process_dir (char *pathname, char *name,
/* Make sure we hasn't used the variable subdirs_left if we knew
* we shouldn't do so.
*/
- assert(0 == subdirs_left || options.no_leaf_check);
+ assert (0 == subdirs_left || options.no_leaf_check);
}
}
Index: find/fstype.c
===================================================================
RCS file: /sources/findutils/findutils/find/fstype.c,v
retrieving revision 1.34
diff -u -p -r1.34 fstype.c
--- find/fstype.c 21 Jun 2007 23:41:05 -0000 1.34
+++ find/fstype.c 26 Jun 2007 08:21:33 -0000
@@ -27,12 +27,12 @@
#include
#include
-#include
#include
#ifdef HAVE_SYS_TYPES_H
#include
#endif
+#include
/* The presence of unistd.h is assumed by gnulib these days, so we
* might as well assume it too.
Index: find/ftsfind.c
===================================================================
RCS file: /sources/findutils/findutils/find/ftsfind.c,v
retrieving revision 1.33
diff -u -p -r1.33 ftsfind.c
--- find/ftsfind.c 21 Jun 2007 23:41:05 -0000 1.33
+++ find/ftsfind.c 26 Jun 2007 08:21:33 -0000
@@ -44,6 +44,7 @@
#else
#include
#endif
+#include
#include
@@ -106,8 +107,8 @@ int get_current_dirfd(void)
{
if (ftsoptions & FTS_CWDFD)
{
- assert(curr_fd != -1);
- assert( (AT_FDCWD == curr_fd) || (curr_fd >= 0) );
+ assert (curr_fd != -1);
+ assert ( (AT_FDCWD == curr_fd) || (curr_fd >= 0) );
if (AT_FDCWD == curr_fd)
return starting_desc;
@@ -145,7 +146,7 @@ static void inside_dir(int dirfd)
{
if (ftsoptions & FTS_CWDFD)
{
- assert(dirfd == AT_FDCWD || dirfd >= 0);
+ assert (dirfd == AT_FDCWD || dirfd >= 0);
state.cwd_dir_fd = dirfd;
if (curr_fd < 0)
@@ -164,7 +165,7 @@ static void inside_dir(int dirfd)
/* curr_fd is invalid, but dirfd is also invalid.
* This should not have happened.
*/
- assert(curr_fd >= 0 || dirfd >= 0);
+ assert (curr_fd >= 0 || dirfd >= 0);
}
}
}
@@ -475,8 +476,8 @@ consider_visiting(FTS *p, FTSENT *ent)
if (ent->fts_info == FTS_NSOK
|| ent->fts_info == FTS_NS /* e.g. symlink loop */)
{
- assert(!state.have_stat);
- assert(!state.have_type);
+ assert (!state.have_stat);
+ assert (!state.have_type);
state.type = mode = 0;
}
else
Index: find/parser.c
===================================================================
RCS file: /sources/findutils/findutils/find/parser.c,v
retrieving revision 1.126
diff -u -p -r1.126 parser.c
--- find/parser.c 21 Jun 2007 23:41:05 -0000 1.126
+++ find/parser.c 26 Jun 2007 08:21:34 -0000
@@ -56,6 +56,7 @@
*/
/* We need for isatty(). */
#include
+#include
#if ENABLE_NLS
# include
@@ -372,8 +373,7 @@ get_stat_Ytime(const struct stat *p,
*ret = get_stat_mtime(p);
return 1;
default:
- assert(0);
- abort();
+ assert (0);
abort();
}
}
@@ -1417,7 +1417,7 @@ parse_newerXY (const struct parser_table
char x, y;
const char validchars[] = "aBcmt";
- assert(0 == strncmp("-newer", argv[*arg_ptr], 6));
+ assert (0 == strncmp("-newer", argv[*arg_ptr], 6));
x = argv[*arg_ptr][6];
y = argv[*arg_ptr][7];
@@ -1465,8 +1465,8 @@ parse_newerXY (const struct parser_table
our_pred->args.reftime.xval = XVAL_MTIME;
break;
default:
- assert(strchr(validchars, x));
- assert(0);
+ assert (strchr(validchars, x));
+ assert (0);
}
if ('t' == y)
@@ -1500,9 +1500,9 @@ parse_newerXY (const struct parser_table
our_pred->est_success_rate = estimate_timestamp_success_rate(our_pred->args.reftime.ts.tv_sec);
(*arg_ptr)++;
- assert(our_pred->pred_func != NULL);
- assert(our_pred->pred_func == pred_newerXY);
- assert(our_pred->need_stat);
+ assert (our_pred->pred_func != NULL);
+ assert (our_pred->pred_func == pred_newerXY);
+ assert (our_pred->need_stat);
return true;
}
}
@@ -2072,7 +2072,7 @@ parse_samefile (const struct parser_tabl
{
if (options.open_nofollow_available)
{
- assert(O_NOFOLLOW != 0);
+ assert (O_NOFOLLOW != 0);
openflags |= O_NOFOLLOW;
fd = -1; /* safe to open it. */
}
@@ -2102,7 +2102,7 @@ parse_samefile (const struct parser_tabl
fd = -1; /* safe to open it without O_NOFOLLOW */
}
- assert(fd != -3); /* check we made a decision */
+ assert (fd != -3); /* check we made a decision */
if (fd == -1)
{
/* Race condition here. The file might become a
@@ -2743,8 +2743,8 @@ make_segment (struct segment **segment,
{
case KIND_PLAIN: /* Plain text string, no % conversion. */
case KIND_STOP: /* Terminate argument, no newline. */
- assert(0 == format_char);
- assert(0 == aux_format_char);
+ assert (0 == format_char);
+ assert (0 == aux_format_char);
*fmt = '\0';
if (mycost > pred->p_cost)
pred->p_cost = NeedsNothing;
@@ -2752,7 +2752,7 @@ make_segment (struct segment **segment,
break;
}
- assert(kind == KIND_FORMAT);
+ assert (kind == KIND_FORMAT);
switch (format_char)
{
case 'l': /* object of symlink */
Index: find/pred.c
===================================================================
RCS file: /sources/findutils/findutils/find/pred.c,v
retrieving revision 1.100
diff -u -p -r1.100 pred.c
--- find/pred.c 21 Jun 2007 23:41:05 -0000 1.100
+++ find/pred.c 26 Jun 2007 08:21:35 -0000
@@ -319,7 +319,7 @@ boolean
pred_anewer (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
- assert(COMP_GT == pred_ptr->args.reftime.kind);
+ assert (COMP_GT == pred_ptr->args.reftime.kind);
return compare_ts(get_stat_atime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
@@ -352,7 +352,7 @@ pred_cnewer (const char *pathname, struc
{
(void) pathname;
- assert(COMP_GT == pred_ptr->args.reftime.kind);
+ assert (COMP_GT == pred_ptr->args.reftime.kind);
return compare_ts(get_stat_ctime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
@@ -1065,7 +1065,7 @@ pred_fprintf (const char *pathname, stru
valid = 1;
break;
default:
- assert(0);
+ assert (0);
abort ();
}
/* We trust the output of format_date not to contain
@@ -1294,7 +1294,7 @@ pred_newer (const char *pathname, struct
{
(void) pathname;
- assert(COMP_GT == pred_ptr->args.reftime.kind);
+ assert (COMP_GT == pred_ptr->args.reftime.kind);
return compare_ts(get_stat_mtime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
@@ -1304,12 +1304,12 @@ pred_newerXY (const char *pathname, stru
struct timespec ts;
boolean collected = false;
- assert(COMP_GT == pred_ptr->args.reftime.kind);
+ assert (COMP_GT == pred_ptr->args.reftime.kind);
switch (pred_ptr->args.reftime.xval)
{
case XVAL_TIME:
- assert(pred_ptr->args.reftime.xval != XVAL_TIME);
+ assert (pred_ptr->args.reftime.xval != XVAL_TIME);
return false;
case XVAL_ATIME:
@@ -1340,7 +1340,7 @@ pred_newerXY (const char *pathname, stru
break;
}
- assert(collected);
+ assert (collected);
return compare_ts(ts, pred_ptr->args.reftime.ts) > 0;
}
@@ -1667,7 +1667,7 @@ pred_type (const char *pathname, struct
mode_t mode;
mode_t type = pred_ptr->args.type;
- assert(state.have_type);
+ assert (state.have_type);
if (0 == state.type)
{
@@ -1860,7 +1860,7 @@ prep_child_for_exec (boolean close_stdin
*/
if (dirfd != AT_FDCWD)
{
- assert(dirfd >= 0);
+ assert (dirfd >= 0);
if (0 != fchdir(dirfd))
{
/* If we cannot execute our command in the correct directory,
@@ -1886,8 +1886,8 @@ launch (const struct buildcmd_control *c
if (!execp->use_current_dir)
{
- assert(starting_desc >= 0);
- assert(execp->dirfd == starting_desc);
+ assert (starting_desc >= 0);
+ assert (execp->dirfd == starting_desc);
}
@@ -1911,7 +1911,7 @@ launch (const struct buildcmd_control *c
if (child_pid == 0)
{
/* We are the child. */
- assert(starting_desc >= 0);
+ assert (starting_desc >= 0);
if (!prep_child_for_exec(execp->close_stdin, execp->dirfd))
{
_exit(1);
@@ -2025,7 +2025,7 @@ format_date (struct timespec ts, int kin
* demonstrating that the performance difference is actually
* measurable.
*/
- assert(sizeof(buf) >= LONGEST_HUMAN_READABLE);
+ assert (sizeof(buf) >= LONGEST_HUMAN_READABLE);
charsprinted = 0;
need_ns_suffix = 0;
@@ -2067,7 +2067,7 @@ format_date (struct timespec ts, int kin
*/
ns_buf[0] = 0;
charsprinted = snprintf(ns_buf, NS_BUF_LEN, ".%09ld0", (long int)ts.tv_nsec);
- assert(charsprinted < NS_BUF_LEN);
+ assert (charsprinted < NS_BUF_LEN);
}
if (kind != '@'
@@ -2079,7 +2079,7 @@ format_date (struct timespec ts, int kin
*/
if (need_ns_suffix)
{
- assert((sizeof buf - strlen(buf)) > strlen(ns_buf));
+ assert ((sizeof buf - strlen(buf)) > strlen(ns_buf));
strcat(buf, ns_buf);
}
return buf;
@@ -2094,8 +2094,8 @@ format_date (struct timespec ts, int kin
*/
char *p = human_readable (ts.tv_sec < 0 ? -w : w, buf + 1,
human_ceiling, 1, 1);
- assert(p > buf);
- assert(p < (buf + (sizeof buf)));
+ assert (p > buf);
+ assert (p < (buf + (sizeof buf)));
if (ts.tv_sec < 0)
*--p = '-'; /* XXX: Ugh, relying on internal details of human_readable(). */
@@ -2108,7 +2108,7 @@ format_date (struct timespec ts, int kin
{
len = strlen(p);
used = (p-buf) + len; /* Offset into buf of current end */
- assert(sizeof buf > used); /* Ensure we can perform subtraction safely. */
+ assert (sizeof buf > used); /* Ensure we can perform subtraction safely. */
remaining = sizeof buf - used - 1u; /* allow space for NUL */
if (strlen(ns_buf) >= remaining)
@@ -2117,7 +2117,7 @@ format_date (struct timespec ts, int kin
"charsprinted=%ld but remaining=%lu: ns_buf=%s",
(long)charsprinted, (unsigned long)remaining, ns_buf);
}
- assert(strlen(ns_buf) < remaining);
+ assert (strlen(ns_buf) < remaining);
strcat(p, ns_buf);
}
return p;
@@ -2146,14 +2146,14 @@ ctime_format (struct timespec ts)
ptm = localtime(&ts.tv_sec);
if (ptm)
{
- assert(ptm->tm_wday >= 0);
- assert(ptm->tm_wday < 7);
- assert(ptm->tm_mon >= 0);
- assert(ptm->tm_mon < 12);
- assert(ptm->tm_hour >= 0);
- assert(ptm->tm_hour < 24);
- assert(ptm->tm_min < 60);
- assert(ptm->tm_sec <= 61); /* allows 2 leap seconds. */
+ assert (ptm->tm_wday >= 0);
+ assert (ptm->tm_wday < 7);
+ assert (ptm->tm_mon >= 0);
+ assert (ptm->tm_mon < 12);
+ assert (ptm->tm_hour >= 0);
+ assert (ptm->tm_hour < 24);
+ assert (ptm->tm_min < 60);
+ assert (ptm->tm_sec <= 61); /* allows 2 leap seconds. */
/* wkday mon mday hh:mm:ss.nnnnnnnnn yyyy */
nout = snprintf(resultbuf, TIME_BUF_LEN,
@@ -2167,7 +2167,7 @@ ctime_format (struct timespec ts)
(long int)ts.tv_nsec,
1900 + ptm->tm_year);
- assert(nout < TIME_BUF_LEN);
+ assert (nout < TIME_BUF_LEN);
return resultbuf;
}
else
@@ -2294,7 +2294,7 @@ void show_success_rates(const struct pre
void
pred_sanity_check(const struct predicate *predicates)
{
- /* Do nothing, since assert() is a no-op with _NDEBUG set */
+ /* Do nothing, since assert is a no-op with _NDEBUG set */
return;
}
#else
@@ -2306,10 +2306,10 @@ pred_sanity_check(const struct predicate
for (p=predicates; p != NULL; p=p->pred_next)
{
/* All predicates must do something. */
- assert(p->pred_func != NULL);
+ assert (p->pred_func != NULL);
/* All predicates must have a parser table entry. */
- assert(p->parser_entry != NULL);
+ assert (p->parser_entry != NULL);
/* If the parser table tells us that just one predicate function is
* possible, verify that that is still the one that is in effect.
@@ -2318,7 +2318,7 @@ pred_sanity_check(const struct predicate
*/
if (p->parser_entry->pred_func)
{
- assert(p->parser_entry->pred_func == p->pred_func);
+ assert (p->parser_entry->pred_func == p->pred_func);
}
switch (p->parser_entry->type)
@@ -2334,8 +2334,8 @@ pred_sanity_check(const struct predicate
*/
case ARG_OPTION:
case ARG_POSITIONAL_OPTION:
- assert(p->parser_entry->type != ARG_OPTION);
- assert(p->parser_entry->type != ARG_POSITIONAL_OPTION);
+ assert (p->parser_entry->type != ARG_OPTION);
+ assert (p->parser_entry->type != ARG_POSITIONAL_OPTION);
break;
case ARG_ACTION:
@@ -2345,7 +2345,7 @@ pred_sanity_check(const struct predicate
/* actions other than -prune and -quit should
* inhibit the default -print
*/
- assert(p->no_default_print);
+ assert (p->no_default_print);
}
break;
@@ -2359,8 +2359,8 @@ pred_sanity_check(const struct predicate
/* Punctuation and tests should have no side
* effects and not inhibit default print.
*/
- assert(!p->no_default_print);
- assert(!p->side_effects);
+ assert (!p->no_default_print);
+ assert (!p->side_effects);
break;
}
}
Index: find/tree.c
===================================================================
RCS file: /sources/findutils/findutils/find/tree.c,v
retrieving revision 1.37
diff -u -p -r1.37 tree.c
--- find/tree.c 21 Jun 2007 23:41:06 -0000 1.37
+++ find/tree.c 26 Jun 2007 08:21:35 -0000
@@ -971,13 +971,7 @@ check_sorted(void *base, size_t members,
if (result < 0)
return false;
result = cmpfn(p+(i-1)*membersize, p+i*membersize);
- assert(result <= 0);
- }
- for (i=1u; ifn <= pl2->fn);
+ assert (result <= 0);
}
return true;
}
@@ -988,11 +982,16 @@ cost_table_comparison(const void *p1, co
{
const struct pred_cost_lookup *pc1 = p1;
const struct pred_cost_lookup *pc2 = p2;
-
-
+ const void* pf1 = (const void*)pc1->fn;
+ const void* pf2 = (const void*)pc2->fn;
+
+ /* We use casts to void* for > comparison because not all C
+ * compilers allow order comparison between functions. For example,
+ * that would fail on DEC Alpha OSF/1 with native cc.
+ */
if (pc1->fn == pc2->fn)
return 0;
- else if (pc1->fn > pc2->fn)
+ else if (pf1 > pf2)
return 1;
else
return -1;
@@ -1103,32 +1102,32 @@ getrate(const struct predicate *p)
float
calculate_derived_rates(struct predicate *p)
{
- assert(NULL != p);
+ assert (NULL != p);
if (p->pred_right)
calculate_derived_rates(p->pred_right);
if (p->pred_left)
calculate_derived_rates(p->pred_left);
- assert(p->p_type != CLOSE_PAREN);
- assert(p->p_type != OPEN_PAREN);
+ assert (p->p_type != CLOSE_PAREN);
+ assert (p->p_type != OPEN_PAREN);
switch (p->p_type)
{
case NO_TYPE:
- assert(NULL == p->pred_right);
- assert(NULL == p->pred_left);
+ assert (NULL == p->pred_right);
+ assert (NULL == p->pred_left);
return p->est_success_rate;
case PRIMARY_TYPE:
- assert(NULL == p->pred_right);
- assert(NULL == p->pred_left);
+ assert (NULL == p->pred_right);
+ assert (NULL == p->pred_left);
return p->est_success_rate;
case UNI_OP:
/* Unary operators must have exactly one operand */
- assert(pred_is(p, pred_negate));
- assert(NULL == p->pred_left);
+ assert (pred_is(p, pred_negate));
+ assert (NULL == p->pred_left);
p->est_success_rate = (1.0 - p->pred_right->est_success_rate);
return p->est_success_rate;
@@ -1151,8 +1150,8 @@ calculate_derived_rates(struct predicate
else
{
/* only and, or and comma are BI_OP. */
- assert(0);
- rate = 0.0f;
+ assert (0);
+ abort ();
}
p->est_success_rate = constrain_rate(rate);
}
@@ -1174,12 +1173,12 @@ static void check_normalization(struct p
{
if (at_root)
{
- assert(BI_OP == p->p_type);
+ assert (BI_OP == p->p_type);
}
if (p->pred_left)
{
- assert(BI_OP == p->pred_left->p_type);
+ assert (BI_OP == p->pred_left->p_type);
check_normalization(p->pred_left, false);
}
if (p->pred_right)
@@ -1212,9 +1211,9 @@ build_expression_tree(int argc, char *ar
entry_open = find_parser("(");
entry_close = find_parser(")");
entry_print = find_parser("print");
- assert(entry_open != NULL);
- assert(entry_close != NULL);
- assert(entry_print != NULL);
+ assert (entry_open != NULL);
+ assert (entry_close != NULL);
+ assert (entry_print != NULL);
parse_openparen (entry_open, argv, &argc);
last_pred->p_name = "(";
@@ -1410,8 +1409,8 @@ get_new_pred (const struct parser_table
(void) entry;
/* Options should not be turned into predicates. */
- assert(entry->type != ARG_OPTION);
- assert(entry->type != ARG_POSITIONAL_OPTION);
+ assert (entry->type != ARG_OPTION);
+ assert (entry->type != ARG_POSITIONAL_OPTION);
if (predicates == NULL)
{
@@ -1460,7 +1459,7 @@ get_new_pred_chk_op (const struct parser
entry_and = find_parser("and");
/* Check that it's actually there. If not, that is a bug.*/
- assert(entry_and != NULL);
+ assert (entry_and != NULL);
if (last_pred)
switch (last_pred->p_type)
Index: find/util.c
===================================================================
RCS file: /sources/findutils/findutils/find/util.c,v
retrieving revision 1.44
diff -u -p -r1.44 util.c
--- find/util.c 21 Jun 2007 23:41:06 -0000 1.44
+++ find/util.c 26 Jun 2007 08:21:35 -0000
@@ -125,7 +125,7 @@ insert_primary_withpred (const struct pa
struct predicate *
insert_primary (const struct parser_table *entry)
{
- assert(entry->pred_func != NULL);
+ assert (entry->pred_func != NULL);
return insert_primary_withpred(entry, entry->pred_func);
}
@@ -299,7 +299,7 @@ do_complete_pending_execdirs(struct pred
if (NULL == p)
return;
- assert(state.execdirs_outstanding);
+ assert (state.execdirs_outstanding);
do_complete_pending_execdirs(p->pred_left, dirfd);
@@ -524,7 +524,7 @@ int
optionh_stat(const char *name, struct stat *p)
{
if (AT_FDCWD != state.cwd_dir_fd)
- assert(state.cwd_dir_fd >= 0);
+ assert (state.cwd_dir_fd >= 0);
set_stat_placeholders(p);
if (0 == state.curdepth)
{
@@ -555,7 +555,7 @@ optionl_stat(const char *name, struct st
{
int rv;
if (AT_FDCWD != state.cwd_dir_fd)
- assert(state.cwd_dir_fd >= 0);
+ assert (state.cwd_dir_fd >= 0);
set_stat_placeholders(p);
rv = fstatat(state.cwd_dir_fd, name, p, 0);
@@ -572,7 +572,7 @@ optionl_stat(const char *name, struct st
int
optionp_stat(const char *name, struct stat *p)
{
- assert((state.cwd_dir_fd >= 0) || (state.cwd_dir_fd==AT_FDCWD));
+ assert ((state.cwd_dir_fd >= 0) || (state.cwd_dir_fd==AT_FDCWD));
set_stat_placeholders(p);
return fstatat(state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);
}
@@ -596,7 +596,7 @@ debug_stat (const char *file, struct sta
return optionp_stat(file, bufp);
}
/*NOTREACHED*/
- assert(false);
+ assert (0);
return -1;
}
@@ -885,7 +885,7 @@ now(void)
return retval;
}
t = time(NULL);
- assert(t != (time_t)-1);
+ assert (t != (time_t)-1);
retval.tv_sec = t;
retval.tv_nsec = 0;
return retval;
Index: lib/buildcmd.c
===================================================================
RCS file: /sources/findutils/findutils/lib/buildcmd.c,v
retrieving revision 1.25
diff -u -p -r1.25 buildcmd.c
--- lib/buildcmd.c 21 Jun 2007 23:41:06 -0000 1.25
+++ lib/buildcmd.c 26 Jun 2007 08:21:35 -0000
@@ -390,7 +390,7 @@ bc_get_arg_max(void)
/* We may resort to using LONG_MAX, so check it fits. */
/* XXX: better to do a compile-time check */
- assert( (~(size_t)0) >= LONG_MAX);
+ assert ( (~(size_t)0) >= LONG_MAX);
#ifdef _SC_ARG_MAX
val = sysconf(_SC_ARG_MAX);
@@ -483,7 +483,7 @@ bc_init_controlinfo(struct buildcmd_cont
/* need to subtract 2 on the following line - for Linux/PPC */
ctl->max_arg_count = (ctl->posix_arg_size_max / sizeof(char*)) - 2u;
- assert(ctl->max_arg_count > 0);
+ assert (ctl->max_arg_count > 0);
ctl->rplen = 0u;
ctl->replace_pat = NULL;
ctl->initial_argc = 0;
@@ -531,7 +531,7 @@ bc_init_state(const struct buildcmd_cont
* LONG_MAX. Adding one to it is safe though because earlier we
* subtracted 2048.
*/
- assert(ctl->arg_max <= (LONG_MAX - 2048L));
+ assert (ctl->arg_max <= (LONG_MAX - 2048L));
state->argbuf = xmalloc (ctl->arg_max + 1u);
state->cmd_argv_chars = state->cmd_initial_argv_chars = 0;
Index: lib/buildcmd.h
===================================================================
RCS file: /sources/findutils/findutils/lib/buildcmd.h,v
retrieving revision 1.10
diff -u -p -r1.10 buildcmd.h
--- lib/buildcmd.h 28 Apr 2007 14:27:40 -0000 1.10
+++ lib/buildcmd.h 26 Jun 2007 08:21:35 -0000
@@ -103,7 +103,7 @@ enum BC_INIT_STATUS
{
BC_INIT_OK = 0,
BC_INIT_ENV_TOO_BIG,
- BC_INIT_CANNOT_ACCOMODATE_HEADROOM,
+ BC_INIT_CANNOT_ACCOMODATE_HEADROOM
};
extern size_t bc_size_of_environment (void);
Index: lib/extendbuf.c
===================================================================
RCS file: /sources/findutils/findutils/lib/extendbuf.c,v
retrieving revision 1.4
diff -u -p -r1.4 extendbuf.c
--- lib/extendbuf.c 21 Jun 2007 23:41:06 -0000 1.4
+++ lib/extendbuf.c 26 Jun 2007 08:21:35 -0000
@@ -66,7 +66,7 @@ extendbuf(void* existing, size_t wanted,
saved_errno = errno;
- assert(wanted > 0u);
+ assert (wanted > 0u);
newsize = decide_size(*allocated, wanted);
if ( (*allocated) == 0 )
@@ -74,7 +74,7 @@ extendbuf(void* existing, size_t wanted,
/* Sanity check: If there is no existing allocation size, there
* must be no existing allocated buffer.
*/
- assert(NULL == existing);
+ assert (NULL == existing);
(*allocated) = newsize;
result = xmalloc(newsize);
Index: locate/frcode.c
===================================================================
RCS file: /sources/findutils/findutils/locate/frcode.c,v
retrieving revision 1.20
diff -u -p -r1.20 frcode.c
--- locate/frcode.c 21 Jun 2007 23:41:07 -0000 1.20
+++ locate/frcode.c 26 Jun 2007 08:21:35 -0000
@@ -127,8 +127,8 @@ put_short (int c, FILE *fp)
* indicates that the result of shifting a negative value right is
* implementation defined.
*/
- assert(c <= SHRT_MAX);
- assert(c >= SHRT_MIN);
+ assert (c <= SHRT_MAX);
+ assert (c >= SHRT_MIN);
return (putc (c >> 8, fp) != EOF) && (putc (c, fp) != EOF);
}
Index: locate/locate.c
===================================================================
RCS file: /sources/findutils/findutils/locate/locate.c,v
retrieving revision 1.84
diff -u -p -r1.84 locate.c
--- locate/locate.c 21 Jun 2007 23:41:08 -0000 1.84
+++ locate/locate.c 26 Jun 2007 08:21:36 -0000
@@ -1187,10 +1187,10 @@ search_one_database (int argc,
int i;
nread += nread2;
+ extend (&procdata, 256u, 0u);
/* Read the list of the most common bigrams in the database. */
if (nread < 256)
{
- extend (&procdata, 256u, 0u);
int more_read = fread (procdata.original_filename + nread, 1,
256 - nread, procdata.fp);
if ( (more_read + nread) != 256 )
Index: locate/word_io.c
===================================================================
RCS file: /sources/findutils/findutils/locate/word_io.c,v
retrieving revision 1.4
diff -u -p -r1.4 word_io.c
--- locate/word_io.c 10 Jun 2007 10:58:08 -0000 1.4
+++ locate/word_io.c 26 Jun 2007 08:21:36 -0000
@@ -162,7 +162,7 @@ putword (FILE *fp, int word,
/* You must decide before calling this function which
* endianness you want to use.
*/
- assert(endian_state_flag != GetwordEndianStateInitial);
+ assert (endian_state_flag != GetwordEndianStateInitial);
if (GetwordEndianStateSwab == endian_state_flag)
{
word = bswap_32(word);
Index: xargs/xargs.c
===================================================================
RCS file: /sources/findutils/findutils/xargs/xargs.c,v
retrieving revision 1.70
diff -u -p -r1.70 xargs.c
--- xargs/xargs.c 21 Jun 2007 23:41:08 -0000 1.70
+++ xargs/xargs.c 26 Jun 2007 08:21:36 -0000
@@ -281,7 +281,7 @@ get_char_oct_or_hex_escape(const char *s
unsigned long val;
char *endp;
- assert('\\' == s[0]);
+ assert ('\\' == s[0]);
if ('x' == s[1])
{
@@ -470,17 +470,17 @@ main (int argc, char **argv)
/* Note that val can in fact be greater than ARG_MAX
* and bc_ctl.arg_max can also be greater than ARG_MAX.
*/
- assert(bc_ctl.arg_max <= (val-XARGS_POSIX_HEADROOM));
+ assert (bc_ctl.arg_max <= (val-XARGS_POSIX_HEADROOM));
}
else
{
# if defined ARG_MAX
- assert(bc_ctl.arg_max <= (ARG_MAX-XARGS_POSIX_HEADROOM));
+ assert (bc_ctl.arg_max <= (ARG_MAX-XARGS_POSIX_HEADROOM));
# endif
}
#else
/* No _SC_ARG_MAX */
- assert(bc_ctl.arg_max <= (ARG_MAX-XARGS_POSIX_HEADROOM));
+ assert (bc_ctl.arg_max <= (ARG_MAX-XARGS_POSIX_HEADROOM));
#endif
@@ -489,7 +489,7 @@ main (int argc, char **argv)
* conforms to the POSIX requirement that the default command
* line length shall be at least LINE_MAX.
*/
- assert(bc_ctl.arg_max >= LINE_MAX);
+ assert (bc_ctl.arg_max >= LINE_MAX);
#endif
bc_ctl.exec_callback = xargs_do_exec;
@@ -636,7 +636,7 @@ main (int argc, char **argv)
* the environment is too large.
*/
act_on_init_result();
- assert(BC_INIT_OK == bcstatus);
+ assert (BC_INIT_OK == bcstatus);
if (0 == strcmp (input_file, "-"))
{
@@ -679,7 +679,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));
+ assert (sizeof(size_t) <= sizeof(unsigned long));
#endif
if (show_limits)