shithub: mc

Download patch

ref: 7b8904abd412ecf638d1ed90703c3c5ec1ae3f4c
parent: af4742681ef356ac1472856165dbf8059f90c963
author: Ori Bernstein <[email protected]>
date: Sat Sep 6 16:04:38 EDT 2014

Fix hassuffix.

    It should be correct now: Swapped >= to <=, and returned
    false in the right place.

--- a/libstd/hassuffix.myr
+++ b/libstd/hassuffix.myr
@@ -1,4 +1,4 @@
-use "cmp.use"
+use "sleq.use"
 pkg std =
 	const hassuffix	: (s : byte[:], suff : byte[:] -> bool)
 ;;
@@ -6,12 +6,10 @@
 const hassuffix = {s, suff
 	var tail
 
-	if suff.len >= s.len
+	if suff.len <= s.len
 		tail = s[s.len - suff.len:]
-		match strncmp(tail, suff, suff.len)
-		| `Equal:       -> true
-		| _:            -> false
-		;;
+		-> sleq(tail, suff)
 	;;
+	-> false
 }