Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tr revert previous; don't change the logic.
details: https://anonhg.NetBSD.org/src/rev/8d172ac24761
branches: trunk
changeset: 769393:8d172ac24761
user: christos <christos%NetBSD.org@localhost>
date: Thu Sep 08 12:00:26 2011 +0000
description:
revert previous; don't change the logic.
diffstat:
usr.bin/tr/str.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (45 lines):
diff -r 3a971217db0a -r 8d172ac24761 usr.bin/tr/str.c
--- a/usr.bin/tr/str.c Thu Sep 08 11:56:48 2011 +0000
+++ b/usr.bin/tr/str.c Thu Sep 08 12:00:26 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.18 2011/09/08 01:19:52 christos Exp $ */
+/* $NetBSD: str.c,v 1.19 2011/09/08 12:00:26 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-__RCSID("$NetBSD: str.c,v 1.18 2011/09/08 01:19:52 christos Exp $");
+__RCSID("$NetBSD: str.c,v 1.19 2011/09/08 12:00:26 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -168,7 +168,7 @@
static void
genclass(STR *s)
{
- int cnt, (*func)(int);
+ int cnt;
const CLASS *cp;
CLASS tmp;
int *p;
@@ -180,12 +180,12 @@
if ((s->set = p = malloc((NCHARS + 1) * sizeof(*p))) == NULL)
err(1, "malloc");
- for (cnt = 0, func = cp->func; cnt < NCHARS; ++cnt)
- if ((func)(cnt))
+
+ for (cnt = 0; cnt < NCHARS; ++cnt)
+ if ((*cp->func)(cnt))
*p++ = cnt;
- else
- *p++ = 0;
- *p = OOBCH;
+ *p++ = OOBCH;
+ memset(p, 0, NCHARS + 1 - (p - s->set));
s->cnt = 0;
s->state = SET;
Home |
Main Index |
Thread Index |
Old Index