shithub: femtolisp

Download patch

ref: 0183f1511656d53e02d2dd7b8acd001980517a14
parent: 92980154dee84747ca798bafe6e05d87519ab665
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Apr 1 13:42:20 EDT 2023

remove str2int

--- a/llt/int2str.c
+++ b/llt/int2str.c
@@ -28,30 +28,3 @@
             (c >= 'a' && c < 'a'+base-10) ||
             (c >= 'A' && c < 'A'+base-10));
 }
-
-/* assumes valid base, returns 1 on error, 0 if OK */
-/*
-int str2int(char *str, size_t len, int64_t *res, uint32_t base)
-{
-    int64_t result, place;
-    char digit;
-    int i;
-
-    place = 1; result = 0;
-    for(i=len-1; i>=0; i--) {
-        digit = str[i];
-        if (!isdigit_base(digit, base))
-            return 1;
-        if (digit <= '9')
-            digit -= '0';
-        else if (digit >= 'a')
-            digit = digit-'a'+10;
-        else if (digit >= 'A')
-            digit = digit-'A'+10;
-        result += digit * place;
-        place *= base;
-    }
-    *res = result;
-    return 0;
-}
-*/
--- a/llt/llt.h
+++ b/llt/llt.h
@@ -95,7 +95,6 @@
 
 /* utils.c */
 char *uint2str(char *dest, size_t len, uint64_t num, uint32_t base);
-int str2int(char *str, size_t len, int64_t *res, uint32_t base);
 int isdigit_base(char c, int base);
 
 void llt_init(void);