summary refs log tree commit diff stats
path: root/tests/tstrset.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2008-11-16 22:08:15 +0100
committerAndreas Rumpf <rumpf_a@web.de>2008-11-16 22:08:15 +0100
commit8b2a9401a147bd0b26cd2976ae71a1022fbde8cc (patch)
treec1a1323003ee8148af5dc60bcf1b88157dd00eb8 /tests/tstrset.nim
parent972c51086152bd45aef4eb17c099fa3472a19d04 (diff)
downloadNim-8b2a9401a147bd0b26cd2976ae71a1022fbde8cc.tar.gz
version 0.7.0
Diffstat (limited to 'tests/tstrset.nim')
-rw-r--r--tests/tstrset.nim12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/tstrset.nim b/tests/tstrset.nim
index 76900bf63..e19ccee4d 100644
--- a/tests/tstrset.nim
+++ b/tests/tstrset.nim
@@ -2,7 +2,7 @@
 
 type
   TRadixNodeKind = enum rnLinear, rnFull, rnLeaf
-  PRadixNode = ptr TRadixNode
+  PRadixNode = ref TRadixNode
   TRadixNode = object
     kind: TRadixNodeKind
   TRadixNodeLinear = object of TRadixNode
@@ -24,7 +24,7 @@ proc search(r: PRadixNode, s: string): PRadixNode =
     case r.kind
     of rnLinear:
       var x = PRadixNodeLinear(r)
-      for j in 0..x.len-1:
+      for j in 0..ze(x.len)-1:
         if x.keys[j] == s[i]:
           if s[i] == '\0': return r
           r = x.vals[j]
@@ -56,21 +56,19 @@ proc testOrincl*(r: var PRadixNode, s: string): bool =
 proc incl*(r: var PRadixNode, s: string) = discard testOrIncl(r, s)
 
 proc excl*(r: var PRadixNode, s: string) =
-  x = search(r, s)
+  var x = search(r, s)
   if x == nil: return
   case x.kind
   of rnLeaf: PRadixNodeLeaf(x).s = ""
   of rnFull: PRadixNodeFull(x).b['\0'] = nil
   of rnLinear:
     var x = PRadixNodeLinear(x)
-    for i in 0..x.len-1:
+    for i in 0..ze(x.len)-1:
       if x.keys[i] == '\0':
-        swap(x.keys[i], x.keys[x.len-1])
+        swap(x.keys[i], x.keys[ze(x.len)-1])
         dec(x.len)
         break
 
 var
   root: PRadixNode
 
-
-