X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_maild%2Fmail_list.c;h=b96c8eff81a99d8149925abe7868989d97d6cd64;hp=1e70a9ed7ab9af5d741bb8d20937da58bce6a718;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/os_maild/mail_list.c b/src/os_maild/mail_list.c index 1e70a9e..b96c8ef 100755 --- a/src/os_maild/mail_list.c +++ b/src/os_maild/mail_list.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/os_maild/mail_list.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. @@ -9,7 +10,7 @@ * Foundation */ - + #include #include #include @@ -35,7 +36,7 @@ void OS_CreateMailList(int maxsize) _memorymaxsize = maxsize; _memoryused = 0; - + return; } @@ -58,13 +59,13 @@ MailNode *OS_PopLastMail() n_node = NULL; return(NULL); } - + _memoryused--; - + lastnode = lastnode->prev; /* Remove the last */ - return(oldlast); + return(oldlast); } @@ -72,14 +73,14 @@ void FreeMailMsg(MailMsg *ml) { if(ml == NULL) return; - + if(ml->subject) free(ml->subject); - + if(ml->body) free(ml->body); - - free(ml); + + free(ml); } @@ -90,11 +91,11 @@ void FreeMail(MailNode *ml) return; if(ml->mail->subject) free(ml->mail->subject); - + if(ml->mail->body) free(ml->mail->body); - free(ml->mail); + free(ml->mail); free(ml); } @@ -103,32 +104,32 @@ void FreeMail(MailNode *ml) void OS_AddMailtoList(MailMsg *ml) { MailNode *tmp_node = n_node; - + if(tmp_node) { MailNode *new_node; new_node = (MailNode *)calloc(1,sizeof(MailNode)); - + if(new_node == NULL) { ErrorExit(MEM_ERROR,ARGV0); } - /* Always adding to the beginning of the list + /* Always adding to the beginning of the list * The new node will become the first node and * new_node->next will be the previous first node */ new_node->next = tmp_node; new_node->prev = NULL; tmp_node->prev = new_node; - + n_node = new_node; /* Adding the event to the node */ new_node->mail = ml; _memoryused++; - + /* Need to remove the last node */ if(_memoryused > _memorymaxsize) { @@ -136,14 +137,14 @@ void OS_AddMailtoList(MailMsg *ml) oldlast = lastnode; lastnode = lastnode->prev; - + /* free last node */ FreeMail(oldlast); - + _memoryused--; } } - + else { /* Adding first node */ @@ -156,8 +157,8 @@ void OS_AddMailtoList(MailMsg *ml) n_node->prev = NULL; n_node->next = NULL; n_node->mail = ml; - - lastnode = n_node; + + lastnode = n_node; } return;