- grow_table didn't update the array size after growing
- if string "b" was longer than "a", strcmp_n returned a positive value
  indicating a > b
---
 software/libfpvm/unique.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/software/libfpvm/unique.c b/software/libfpvm/unique.c
index f6f4bca..494537e 100644
--- a/software/libfpvm/unique.c
+++ b/software/libfpvm/unique.c
@@ -39,7 +39,7 @@ static int strcmp_n(const char *a, const char *b, int n)
        if (diff)
                return diff;
        /* handle implicit NUL in string "a" */
-       return b[n];
+       return -b[n];
 }
 
 
@@ -123,6 +123,7 @@ static void grow_table(void)
        new = malloc(allocate*sizeof(*vars));
        memcpy(new, vars, allocated*sizeof(*vars));
        vars = new;
+       allocated = allocate;
 }
 
 
-- 
1.7.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to