Replace abort by assert for static analyszer

This commit is contained in:
Patrick Pelissier committed 2020-08-22 18:58:48 +02:00
1 parent 805c747c60
commit eb7556f88f
1 file changed
+3 -2
+3 -2
View File
@@ -44,13 +44,14 @@ static inline void testobj_init(testobj_t z)
z->n = 1;
z->a = 1;
z->ptr = (unsigned int*) calloc(1, sizeof(unsigned int));
if (!z->ptr) abort();
assert(z->ptr != NULL);
z->allocated = true;
}
static inline void testobj_clear(testobj_t z)
{
assert (z->allocated);
assert (z->ptr != NULL);
free(z->ptr);
z->ptr = NULL;
z->allocated = false;
@@ -61,7 +62,7 @@ static inline void testobj_init_set(testobj_t d, const testobj_t s)
d->n = s->n;
d->a = s->n;
d->ptr = (unsigned int *) calloc (s->n, sizeof(unsigned int));
if (!d->ptr) abort();
assert(d->ptr != NULL);
memcpy(d->ptr, s->ptr, sizeof(unsigned int) * s->n);
d->allocated = true;
}