about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compile.c4
-rw-r--r--vertex.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/compile.c b/compile.c
index d488414..dc070ca 100644
--- a/compile.c
+++ b/compile.c
@@ -106,7 +106,7 @@ roper(struct node *node, struct scope *scope)
 		val = getval(VVAR, eval(node->noper.l, scope), scope, 0);
 		lscope = scope;
 		i = findvar(val.name, &lscope);
-		if (i > 0)
+		if (i >= 0)
 			shouldfree = deref(val, scope);
 
 		r = deref(eval(node->noper.r, scope), scope);
@@ -402,7 +402,7 @@ rwith(struct node *node, struct scope *scope)
 			mod->nmod.len,
 			mod->nmod.len != 1 ? "s" : "",
 			node->nwith.len,
-			mod->nwith.len != 1 ? "s" : ""
+			node->nwith.len != 1 ? "s" : ""
 		);
 
 	argscope.len = mod->nmod.len;
diff --git a/vertex.c b/vertex.c
index b8290b1..fb28029 100644
--- a/vertex.c
+++ b/vertex.c
@@ -46,8 +46,8 @@ mkvert(void)
 void
 addprop(ulong i, vlong prop)
 {
-	if (i < 0 || i >= len)
-		complain(1, "addprop: how would you want this? (0<=%lld<%lld)", i, len);
+	if (i >= len)
+		complain(1, "addprop: how would you want this? (%lld<%lld)", i, len);
 
 	verts[i].props.arr = realloc(
 		verts[i].props.arr,
@@ -64,10 +64,10 @@ addedge(ulong from, ulong to)
 {
 	ulong i;
 
-	if (from < 0 || from >= len)
-		complain(1, "addedge: how would you want this? (0<=%lld<%lld)", from, len);
-	if (to < 0 || to >= len)
-		complain(1, "addedge: how would you want this? (0<=%lld<%lld)", from, len);
+	if (from >= len)
+		complain(1, "addedge: how would you want this? (%lld<%lld)", from, len);
+	if (to >= len)
+		complain(1, "addedge: how would you want this? (%lld<%lld)", from, len);
 
 	for (i = 0; i < verts[from].nbrs.len; ++i)
 		if (verts[from].nbrs.arr[i] == to)