diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-15 08:34:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-15 08:34:05 +0000 |
commit | 4b96b6bff7d5cad383fa7a0d62098f86f30fbc2d (patch) | |
tree | 3d6165f19a6de43f6d53a08e94584af468361719 /bin | |
parent | 6f64d11c445d58c932eeffb177d2e08a8b17d6d4 (diff) |
use a variable
Diffstat (limited to 'bin')
-rw-r--r-- | bin/expr/expr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/expr/expr.c b/bin/expr/expr.c index c8119bcd708..d87cb15505b 100644 --- a/bin/expr/expr.c +++ b/bin/expr/expr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expr.c,v 1.12 2002/07/04 04:26:39 deraadt Exp $ */ +/* $OpenBSD: expr.c,v 1.13 2003/04/15 08:34:04 deraadt Exp $ */ /* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */ /* @@ -141,15 +141,17 @@ void to_string(struct val *vp) { char *tmp; + size_t len; if (vp->type == string) return; - tmp = malloc(25); + len = 25; + tmp = malloc(len); if (tmp == NULL) { err(3, NULL); } - snprintf(tmp, 25, "%d", vp->u.i); + snprintf(tmp, len, "%d", vp->u.i); vp->type = string; vp->u.s = tmp; } |