Replace abort by assert for static analyszer
This commit is contained in:
1 parent
805c747c60
commit
eb7556f88f
1 file changed
+3
-2
+3
-2
@@ -44,13 +44,14 @@ static inline void testobj_init(testobj_t z)
|
|||||||
z->n = 1;
|
z->n = 1;
|
||||||
z->a = 1;
|
z->a = 1;
|
||||||
z->ptr = (unsigned int*) calloc(1, sizeof(unsigned int));
|
z->ptr = (unsigned int*) calloc(1, sizeof(unsigned int));
|
||||||
if (!z->ptr) abort();
|
assert(z->ptr != NULL);
|
||||||
z->allocated = true;
|
z->allocated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void testobj_clear(testobj_t z)
|
static inline void testobj_clear(testobj_t z)
|
||||||
{
|
{
|
||||||
assert (z->allocated);
|
assert (z->allocated);
|
||||||
|
assert (z->ptr != NULL);
|
||||||
free(z->ptr);
|
free(z->ptr);
|
||||||
z->ptr = NULL;
|
z->ptr = NULL;
|
||||||
z->allocated = false;
|
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->n = s->n;
|
||||||
d->a = s->n;
|
d->a = s->n;
|
||||||
d->ptr = (unsigned int *) calloc (s->n, sizeof(unsigned int));
|
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);
|
memcpy(d->ptr, s->ptr, sizeof(unsigned int) * s->n);
|
||||||
d->allocated = true;
|
d->allocated = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user