aboutsummaryrefslogtreecommitdiff
path: root/ll.c
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2023-12-06 17:16:54 -0500
committerHolden Rohrer <hr@hrhr.dev>2023-12-06 17:19:17 -0500
commit0b4bd76e6bcb46074719f950f2b8e2cd464d117d (patch)
treeb16733a2bbf99a89a3f24e24a657ec33161e0263 /ll.c
parent47ff6a368e1925cdc6d9fa197252c62855ec2bab (diff)
old changes I had lying aroundHEADmaster
Looks like I was trying to implement an splint linter here in order to disprove null check errors. This whole thing seems pretty useless except as a C exercise. Why not just use a Wiki or Knuth's WEB or org-mode or a text file with indentation?
Diffstat (limited to 'll.c')
-rw-r--r--ll.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ll.c b/ll.c
index 910b869..3481b8b 100644
--- a/ll.c
+++ b/ll.c
@@ -1,9 +1,14 @@
#include <stdlib.h>
+#include <assert.h>
#include "ll.h"
-llnode* appendll(llnode* tail, char* str){
+llnode* appendll(llnode* tail, /*@nottemp@*/char* str){
llnode* new = malloc(sizeof(llnode));
- if (tail != NULL) tail->next = new;
+ assert(new != NULL);
+ if (tail != NULL) {
+ assert(tail->next == NULL);
+ tail->next = new;
+ }
new->str = str;
new->next = NULL;
return new;