shithub: mc

Download patch

ref: 2c8775977321483c7a16b55c7884612f9f770e6a
parent: d8b4ed369b4f80ac716f86b9707ea5c9fc67ca21
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 31 19:17:57 EST 2017

Avoid pointer casting by slicing.

	It's a bit cleaner to do it this way.

--- a/lib/std/cstrconv.myr
+++ b/lib/std/cstrconv.myr
@@ -16,14 +16,13 @@
 }
 
 const cstrconvp = {p
-	var i, base
+	var len
 
-	i = 0
-	base = (p : intptr)
-	while (base + i : byte#)# != 0
-		i++
+	len = 1
+	while p[:len][len -1] != 0
+		len++
 	;;
-	-> p[:i]
+	-> p[:len-1]
 }
 
 const cstrlen = {buf