From: Florian Forster Date: Tue, 9 May 2017 06:40:33 +0000 (+0200) Subject: src/liboping.c: Use sizeof(*ptr) instead of sizeof(type_t). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9bb97adae60f9fabc9ccfcbd5211491bc1128b9c;p=liboping.git src/liboping.c: Use sizeof(*ptr) instead of sizeof(type_t). Also remove an unnecessary cast from void* to pingobj_t*. --- diff --git a/src/liboping.c b/src/liboping.c index de82d5f..5a39633 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -1123,9 +1123,9 @@ pingobj_t *ping_construct (void) { pingobj_t *obj; - if ((obj = (pingobj_t *) malloc (sizeof (pingobj_t))) == NULL) + if ((obj = malloc (sizeof (*obj))) == NULL) return (NULL); - memset (obj, 0, sizeof (pingobj_t)); + memset (obj, 0, sizeof (*obj)); obj->timeout = PING_DEF_TIMEOUT; obj->ttl = PING_DEF_TTL;