X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Femail.c;h=8898c087020c84d465f42d1569abb193b9230890;hb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;hp=81ae29c3035269513105e87a1193bdc205b9808a;hpb=6894d846ac42cbe88073db074d75279f5a6e31b8;p=collectd.git diff --git a/src/email.c b/src/email.c index 81ae29c3..8898c087 100644 --- a/src/email.c +++ b/src/email.c @@ -219,7 +219,7 @@ static int email_config (const char *key, const char *value) static void type_list_incr (type_list_t *list, char *name, int incr) { if (NULL == list->head) { - list->head = (type_t *)smalloc (sizeof (type_t)); + list->head = smalloc (sizeof (*list->head)); list->head->name = sstrdup (name); list->head->value = incr; @@ -236,7 +236,7 @@ static void type_list_incr (type_list_t *list, char *name, int incr) } if (NULL == ptr) { - list->tail->next = (type_t *)smalloc (sizeof (type_t)); + list->tail->next = smalloc (sizeof (*list->tail->next)); list->tail = list->tail->next; list->tail->name = sstrdup (name); @@ -482,10 +482,10 @@ static void *open_connection (void __attribute__((unused)) *arg) available_collectors = max_conns; collectors = - (collector_t **)smalloc (max_conns * sizeof (collector_t *)); + smalloc (max_conns * sizeof (*collectors)); for (i = 0; i < max_conns; ++i) { - collectors[i] = (collector_t *)smalloc (sizeof (collector_t)); + collectors[i] = smalloc (sizeof (*collectors[i])); collectors[i]->socket = NULL; if (0 != (err = plugin_thread_create (&collectors[i]->thread, @@ -695,7 +695,7 @@ static void copy_type_list (type_list_t *l1, type_list_t *l2) for (ptr1 = l1->head, ptr2 = l2->head; NULL != ptr1; ptr1 = ptr1->next, last = ptr2, ptr2 = ptr2->next) { if (NULL == ptr2) { - ptr2 = (type_t *)smalloc (sizeof (type_t)); + ptr2 = smalloc (sizeof (*ptr2)); ptr2->name = NULL; ptr2->next = NULL;