free.c

来自「UNIX环境高级编程 配套源代码 欢迎大家下载哦」· C语言 代码 · 共 24 行

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

⌨️ 快捷键说明

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