]> git.wincent.com - wikitext.git/commitdiff
Fix off-by-one error in ary.h
authorWincent Colaiuta <win@wincent.com>
Tue, 5 Feb 2008 00:18:42 +0000 (01:18 +0100)
committerWincent Colaiuta <win@wincent.com>
Tue, 5 Feb 2008 00:18:42 +0000 (01:18 +0100)
This bug prevented us from returning items at index 0.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/ary.h

index 53ba747f2078b67de2686d5bfa0131b8c1783e82..98d36ef0c9d16eb010abbd0fb90f2d69db09482b 100644 (file)
--- a/ext/ary.h
+++ b/ext/ary.h
@@ -45,7 +45,7 @@ inline int ary_entry(ary_t *ary, int idx)
 {
     if (idx < 0)
         idx = ary->count + idx;
-    return (idx > 0 && ary->count > idx) ? ary->entries[idx] : INT_MAX;
+    return (idx >= 0 && ary->count > idx) ? ary->entries[idx] : INT_MAX;
 }
 
 inline int ary_delete_at(ary_t *ary, int idx)