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 + -
显示快捷键?