about summary refs log tree commit diff
path: root/vertex.c
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2026-04-07 05:04:48 +0300
committerNakidai <nakidai@disroot.org>2026-04-07 05:04:48 +0300
commit75a1470fd2270eca5f9772b6ed8ad7517eeb30d8 (patch)
treeacb13aa5f15007de24e158be96e683c3f72b2fc4 /vertex.c
parentce8647d2378514e9a77a86639dd23f1adf0f3808 (diff)
downloadthac-75a1470fd2270eca5f9772b6ed8ad7517eeb30d8.tar.gz
thac-75a1470fd2270eca5f9772b6ed8ad7517eeb30d8.zip
Fix some minor issues
- in the OASSIGN of the roper, i=0 means variable is _found_ as the
  first one in the scope, so it should be freed
- in the rwith, nwith is stored by the node, not mod (affects only
  printing of the "s", though, lol)
- in add{edge,prop} target is ulong, so check >=0 is redundant
Diffstat (limited to 'vertex.c')
-rw-r--r--vertex.c12
1 files changed, 6 insertions, 6 deletions
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)