Lisp parsing tweak: use atoi and strtof instead of scanf
authorJann Horn <jann@thejh.net>
Tue, 28 May 2013 19:59:20 +0000 (09:59 -1000)
committerLMH <lmh.0013@gmail.com>
Tue, 28 May 2013 19:59:20 +0000 (09:59 -1000)
src/lisp/parser.cpp

index 1ea6f80..e6a4198 100644 (file)
@@ -192,11 +192,11 @@ Parser::read()
     }
     case Lexer::TOKEN_INTEGER:
       result = new(obst) Lisp(Lisp::TYPE_INTEGER);
-      sscanf(lexer->getString(), "%d", &result->v.integer);
+      result->v.integer = atoi(lexer->getString());
       break;
     case Lexer::TOKEN_REAL:
       result = new(obst) Lisp(Lisp::TYPE_REAL);
-      sscanf(lexer->getString(), "%f", &result->v.real);
+      result->v.real = strtof(lexer->getString(), NULL);
       break;
     case Lexer::TOKEN_TRUE:
       result = new(obst) Lisp(Lisp::TYPE_BOOLEAN);