(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
This commit is contained in:
@@ -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).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -107,6 +107,8 @@ parse_something (const char *s, const struct units *units,
|
|||||||
++p;
|
++p;
|
||||||
val = -1;
|
val = -1;
|
||||||
}
|
}
|
||||||
|
if (val == 0)
|
||||||
|
val = 1;
|
||||||
u_len = strcspn (p, ", \t");
|
u_len = strcspn (p, ", \t");
|
||||||
partial = 0;
|
partial = 0;
|
||||||
partial_unit = NULL;
|
partial_unit = NULL;
|
||||||
@@ -149,9 +151,6 @@ parse_something (const char *s, const struct units *units,
|
|||||||
static int
|
static int
|
||||||
acc_units(int res, int val, unsigned mult)
|
acc_units(int res, int val, unsigned mult)
|
||||||
{
|
{
|
||||||
if (val == 0)
|
|
||||||
val = 1;
|
|
||||||
|
|
||||||
return res + val * mult;
|
return res + val * mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user