Skip to content

Commit

Permalink
tests: Silence some warnings from gcc --analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Quuxplusone committed Jul 7, 2022
1 parent 87d01c1 commit 0b54f6d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test29.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int main()
}

/* now delete the list head */
assert(head != NULL);
printf("deleting head %shead->prev: %s", head->bname, head->prev->bname);
DL_DELETE(head,head);
DL_FOREACH(head,tmp) {
Expand Down
2 changes: 2 additions & 0 deletions tests/test89.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "utlist.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -52,6 +53,7 @@ int main()

for (i = 0; i < sizeof(timestamps)/sizeof(clock_time_t); i++) {
struct netq_t *node = (struct netq_t *)malloc(sizeof *node);
assert(node != NULL);
memset(node, '\0', sizeof *node);
node->t = timestamps[i];

Expand Down
1 change: 1 addition & 0 deletions tests/test90.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int main()
/* fill in the sorted list */
for(i=0; i<100; i++) {
p = (struct item *)malloc(sizeof *p);
assert(p != NULL);

p->sort_field_len = sizeof(int);
p->sort_field = (unsigned char *)malloc(p->sort_field_len);
Expand Down
2 changes: 2 additions & 0 deletions tests/test92.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <assert.h>
#include <stdio.h>

#define HASH_NONFATAL_OOM 1
Expand Down Expand Up @@ -66,6 +67,7 @@ int main()
int i;
int saved_cnt;

assert(user != NULL);
user->id = id;

#ifdef HASH_BLOOM
Expand Down
2 changes: 2 additions & 0 deletions tests/test96.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

Expand Down Expand Up @@ -34,6 +35,7 @@ int main()
for (int i=0; i < 40; ++i) {
struct clockface *elt = (struct clockface *)malloc(sizeof(*elt));
struct clockface *found = NULL;
assert(elt != NULL);
elt->time = random_data[i];
HASH_FIND_INT(times, &elt->time, found);
if (found) {
Expand Down

0 comments on commit 0b54f6d

Please sign in to comment.