From 55bd1adae0a4001b6dc12263ae315330369279fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20W=C3=BCrl?= <bastiwuerl@gmail.com>
Date: Sun, 11 Mar 2018 13:23:36 +0100
Subject: [PATCH] stdlib: cleaner raw pointer handling in a64l

---
 src/stdlib/src/lib.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs
index 228f561d..7813b9bd 100644
--- a/src/stdlib/src/lib.rs
+++ b/src/stdlib/src/lib.rs
@@ -24,12 +24,13 @@ static mut ATEXIT_FUNCS: [Option<extern "C" fn()>; 32] = [None; 32];
 
 #[no_mangle]
 pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
-    if s as isize == 0 {
+    if s.is_null() {
         return 0;
     }
     let mut l: c_long = 0;
-    for x in 0..7 {
-        let c = *((s as isize + x) as *const c_char);
+    // a64l does not support more than 6 characters at once
+    for x in 0..6 {
+        let c = *s.offset(x);
         if c == 0 {
             // string is null terminated
             return l;
-- 
GitLab