altos/lisp: use strtof instead of atof
authorKeith Packard <keithp@keithp.com>
Sun, 3 Dec 2017 05:21:55 +0000 (23:21 -0600)
committerKeith Packard <keithp@keithp.com>
Sun, 3 Dec 2017 05:21:55 +0000 (23:21 -0600)
atof returns double, strtof returns float.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/lisp/ao_lisp_read.c

index 747963ab632b3cdba14d67930c8419b875c8c570..f3b627bbb70c83c1c14b732425e555c64a455594 100644 (file)
@@ -15,6 +15,7 @@
 #include "ao_lisp.h"
 #include "ao_lisp_read.h"
 #include <math.h>
+#include <stdlib.h>
 
 static const uint16_t  lex_classes[128] = {
        IGNORE,         /* ^@ */
@@ -445,7 +446,7 @@ _lex(void)
                                                return NUM;
                                        }
                                        if (isfloat && hasdigit) {
-                                               token_float = atof(token_string);
+                                               token_float = strtof(token_string, NULL);
                                                return FLOAT;
                                        }
                                        for (u = 0; u < NUM_NAMED_FLOATS; u++)
@@ -524,8 +525,7 @@ ao_lisp_read(void)
        char                    *string;
        int                     cons;
        int                     read_state;
-       ao_poly                 v;
-
+       ao_poly                 v = AO_LISP_NIL;
 
        cons = 0;
        read_state = 0;