diff options
author | Holden Rohrer <hr@hrhr.dev> | 2023-12-06 17:16:54 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2023-12-06 17:19:17 -0500 |
commit | 0b4bd76e6bcb46074719f950f2b8e2cd464d117d (patch) | |
tree | b16733a2bbf99a89a3f24e24a657ec33161e0263 /ll.c | |
parent | 47ff6a368e1925cdc6d9fa197252c62855ec2bab (diff) |
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.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; |