free.c

来自「用C语言编的邮件系统(毕业论文)」· C语言 代码 · 共 25 行

C
25
字号
#include	"mail.h"/* Free up a mail structure, and all the malloc'ed buffers it * may point to.  Also close the file descriptors if still open. */int_mail_free(MAIL *mail){	if (mail->idxfd >= 0 && close(mail->idxfd) < 0)		err_dump("index close error");	if (mail->datfd >= 0 && close(mail->datfd) < 0)		err_dump("data close error");	mail->idxfd = mail->datfd = -1;	if (mail->idxbuf != NULL)		free(mail->idxbuf);	if (mail->datbuf != NULL)		free(mail->datbuf);	if (mail->name != NULL)		free(mail->name);	free(mail);	return(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?