Fix a decision bug with trailing stuff in lib.c:is_valid_number

after dec 18 changes. updated FIXES, adjusted version date.
This commit is contained in:
ozan s. yigit 2021-01-06 18:37:48 -05:00
parent 7d1848cfa6
commit 1fd5fa38cc
3 changed files with 13 additions and 2 deletions

4
FIXES
View File

@ -25,6 +25,10 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
January 06, 2021:
Fix a decision bug with trailing stuff in lib.c:is_valid_number
after recent changes. Thanks to Ozan Yigit.
December 18, 2020:
Fix problems converting inf and NaN values in lib.c:is_valid_number.
Enhance number to string conversion to do the right thing for

9
lib.c
View File

@ -822,10 +822,17 @@ convert:
if (result != NULL)
*result = r;
retval = (isspace(*ep) || *ep == '\0' || trailing_stuff_ok);
/*
* check for trailing stuff
*/
while (isspace(*ep))
ep++;
if (no_trailing != NULL)
*no_trailing = (*ep == '\0');
// return true if found the end, or trailing stuff is allowed
retval = *ep == '\0' || trailing_stuff_ok;
return retval;
}

2
main.c
View File

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
const char *version = "version 20201218";
const char *version = "version 20210106";
#define DEBUG
#include <stdio.h>