Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tic Maintain nalias and nterm on the fly.
details: https://anonhg.NetBSD.org/src/rev/e54d54828299
branches: trunk
changeset: 779510:e54d54828299
user: joerg <joerg%NetBSD.org@localhost>
date: Thu May 31 21:01:06 2012 +0000
description:
Maintain nalias and nterm on the fly.
diffstat:
usr.bin/tic/tic.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diffs (69 lines):
diff -r bc1512d118b7 -r e54d54828299 usr.bin/tic/tic.c
--- a/usr.bin/tic/tic.c Thu May 31 20:40:05 2012 +0000
+++ b/usr.bin/tic/tic.c Thu May 31 21:01:06 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tic.c,v 1.17 2012/05/31 20:40:05 joerg Exp $ */
+/* $NetBSD: tic.c,v 1.18 2012/05/31 21:01:06 joerg Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tic.c,v 1.17 2012/05/31 20:40:05 joerg Exp $");
+__RCSID("$NetBSD: tic.c,v 1.18 2012/05/31 21:01:06 joerg Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -73,6 +73,7 @@
static int error_exit;
static int Sflag;
static char *dbname;
+static size_t nterm, nalias;
static void
do_unlink(void)
@@ -149,6 +150,12 @@
elem.key = estrdup(name);
elem.data = term;
hsearch(elem, ENTER);
+
+ if (type == 'a')
+ nalias++;
+ else
+ nterm++;
+
return term;
}
@@ -443,7 +450,7 @@
char *source, *p, *buf, *ofile;
FILE *f;
DBM *db;
- size_t buflen, nterm, nalias;
+ size_t buflen;
ssize_t len;
TBUF tbuf;
TERM *term;
@@ -546,17 +553,11 @@
if (cflag)
return error_exit;
-
+
/* Save the terms */
- nterm = nalias = 0;
- SLIST_FOREACH(term, &terms, next) {
+ SLIST_FOREACH(term, &terms, next)
save_term(db, term);
- if (term->type == 'a')
- nalias++;
- else
- nterm++;
- }
-
+
/* done! */
dbm_close(db);
Home |
Main Index |
Thread Index |
Old Index