diff options
author | kstailey <kstailey@cvs.openbsd.org> | 1997-01-21 23:47:56 +0000 |
---|---|---|
committer | kstailey <kstailey@cvs.openbsd.org> | 1997-01-21 23:47:56 +0000 |
commit | 10f83a28e7afc6bafcfbb3d61dea40c553b5a367 (patch) | |
tree | 14f0be8e5b993de2880f5fc809ae1e7433177770 | |
parent | 962ad9c8af8f1bd22805c5a97712ef566b92f12a (diff) |
optimization: kill two calls to strlen() in format()
-rw-r--r-- | usr.bin/awk/run.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index ed8efd507f8..71a4fcac9b0 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.3 1997/01/21 21:14:06 kstailey Exp $ */ +/* $OpenBSD: run.c,v 1.4 1997/01/21 23:47:55 kstailey Exp $ */ /**************************************************************** Copyright (C) AT&T and Lucent Technologies 1996 All Rights Reserved @@ -791,8 +791,7 @@ int format(char *buf, int bufsize, char *s, Node *a) a = a->nnext; switch (flag) { case 0: sprintf((char *)p, "%s", fmt); /* unknown, so dump it too */ - len += strlen(p); - p += strlen(p); + p += len += strlen(p); sprintf((char *)p, "%s", getsval(x)); break; case 1: sprintf((char *)p, (char *)fmt, getfval(x)); break; @@ -815,8 +814,7 @@ int format(char *buf, int bufsize, char *s, Node *a) break; } tempfree(x); - len += strlen(p); - p += strlen(p); + p += len += strlen(p); s++; } *p = '\0'; |