From 2dbeee4ddc5509dbd6f96bc2bdc7f263ab006b85 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Wed, 23 Jun 1999 12:41:35 +0000 Subject: [PATCH] (acc_units): move the special case of 0 -> 1 to parse_something to avoid having it happen at the end of the string git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6358 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/parse_units.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/roken/parse_units.c b/lib/roken/parse_units.c index 91f90ab1f..6ec18727a 100644 --- a/lib/roken/parse_units.c +++ b/lib/roken/parse_units.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan + * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -107,6 +107,8 @@ parse_something (const char *s, const struct units *units, ++p; val = -1; } + if (val == 0) + val = 1; u_len = strcspn (p, ", \t"); partial = 0; partial_unit = NULL; @@ -149,9 +151,6 @@ parse_something (const char *s, const struct units *units, static int acc_units(int res, int val, unsigned mult) { - if (val == 0) - val = 1; - return res + val * mult; }