You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
856 B
C++

//#include <util/util.h>
#include <stdlib.h>
#include <malloc.h>
#include "confrw_errno.h"
#include "confrw.h"
#include "_confrw.h"
#include "Profile_Hash.h"
/*
* 打开配置文件, 返回表示配置文件的句柄
*
* 参数
* pszfname -- 配置文件的全路径名(默认为 char [MAX_PATH]类型)
* ppvhandle -- 在函数执行成功的情况下, 返回配置文件(的上下文环境)句柄
*
* 返回值
* SUCCESS -- 成功的执行了该函数, 并打开了给定的配置文件
* 其它 -- 失败代码
*
*/
int conf_open ( const char * pszfname, void ** ppvhandle )
{
int ret = SUCCESS;
if ( NULL == pszfname || NULL == ppvhandle )
return ERROR_POINTER;
int handle = -1;
ret = create_profile_cache ( (char *)pszfname, &handle );
if ( SUCCESS != ret )
{
*ppvhandle = NULL;
return ret;
}
else
{
*ppvhandle = calloc ( 1, sizeof(long) );
*((int *)*ppvhandle) = handle;
return SUCCESS;
}
}