]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Work around HPUX /bin/cc compiler bug.
authorJim Meyering <jim@meyering.net>
Sun, 30 May 2004 20:09:24 +0000 (20:09 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 30 May 2004 20:09:24 +0000 (20:09 +0000)
(card_of_complement): Use cleaner `sizeof in_set'
rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
(aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
system, those two expressions are not the same (256 vs. 1024).
The effect of this problem was that `tr -c x y' would fail:
tr: when not truncating set1, string2 must be non-empty

src/tr.c

index 366b217100b0ddc8389235c8efeb75532ab5efaa..88f72422b041243176143d798fbadd751889dc4d 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -1274,7 +1274,7 @@ card_of_complement (struct Spec_list *s)
   int cardinality = N_CHARS;
   SET_TYPE in_set[N_CHARS];
 
-  memset (in_set, 0, N_CHARS * sizeof (in_set[0]));
+  memset (in_set, 0, sizeof in_set);
   s->state = BEGIN_STATE;
   while ((c = get_next (s, NULL)) != -1)
     if (!in_set[c]++)