X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=mail.c;h=efe32aba10d3ff62714ecef1217f166870815e3c;hp=d4c6441e76815f32fda6414ba840363121fa3047;hb=ee848d3a9e333b3b91c0e40679c9d0512d511fc2;hpb=2ed0fee489c37a6e2d4473f6185ebbe3e746ac11 diff --git a/mail.c b/mail.c index d4c6441..efe32ab 100644 --- a/mail.c +++ b/mail.c @@ -9,19 +9,9 @@ ** ** \*****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include #include "main.h" -static char *months[] = { +static const char *months[] = { "January", "February", "March", "April", "Mai", "June", "July", "August", "September", "October", "November", "December" }; @@ -112,8 +102,7 @@ static void *mail_child(void *arg) fprintf(ph, "\n * date: %s %d %d %d:%02d\n\n", months[mon], mday, year+1900, hour, min); /* attach audio file */ - if (filename[0]) - if ((fh = open(filename, O_RDONLY))) + if ((filename[0]) && ((fh = open(filename, O_RDONLY)))) { while(strchr(filename, '/')) filename = strchr(filename, '/')+1; @@ -179,8 +168,7 @@ static void *mail_child(void *arg) PDEBUG(DEBUG_EPOINT, "child process done for sending a mail\n"); /* exit process */ - memset(args, 0, sizeof(struct mail_args)); - free(args); + FREE(args, sizeof(struct mail_args)); amemuse--; return(NULL); } @@ -190,12 +178,7 @@ void send_mail(char *filename, char *callerid, char *callerintern, char *callern struct mail_args *arg; pthread_t tid; - arg = (struct mail_args *)calloc(1, sizeof(struct mail_args)); - if (!arg) - { - PERROR("failed to alloc memory.\n"); - return; - } + arg = (struct mail_args *)MALLOC(sizeof(struct mail_args)); amemuse++; SCPY(arg->email, vbox_email);