Unify fpcrtl_pchar2astr look with fpcrtl_pchar2str
authorunc0rr
Mon, 19 Nov 2018 22:26:47 +0100
changeset 14272 fa2e3f123a09
parent 14271 a7320c65f484
child 14273 bdc7ba72bbad
Unify fpcrtl_pchar2astr look with fpcrtl_pchar2str
project_files/hwc/rtl/misc.c
--- a/project_files/hwc/rtl/misc.c	Mon Nov 19 22:25:02 2018 +0100
+++ b/project_files/hwc/rtl/misc.c	Mon Nov 19 22:26:47 2018 +0100
@@ -163,20 +163,21 @@
 {
     astring result;
 
-    if(!s) {
+    if(!s) 
+    {
         result.len = 0;
-        return result;
-    }
-
-    int rlen = strlen(s);
+    } else
+    {
+        int rlen = strlen(s);
 
-    if(rlen > MAX_ANSISTRING_LENGTH){
-        rlen = MAX_ANSISTRING_LENGTH;
+        if(rlen > MAX_ANSISTRING_LENGTH){
+            rlen = MAX_ANSISTRING_LENGTH;
+        }
+
+        result.len = rlen;
+        memcpy(result.str, s, rlen);
     }
 
-    result.len = rlen;
-    memcpy(result.s + 1, s, rlen);
-
     return result;
 }