master v1.3
brisk 2017-12-28 15:47:14 +08:00
parent abf645c4c5
commit b2a60737a1
4 changed files with 16 additions and 6 deletions

View File

@ -7,13 +7,13 @@ libconf.a:conf.o stack.o hash.o
cp libconf.a lib/
conf.o:src/conf.h src/conf.c
gcc -c src/conf.c
gcc -c src/conf.c -O2 -Wall
stack.o:src/stack/stack.h src/stack/stack.c
gcc -c src/stack/stack.c
gcc -c src/stack/stack.c -O2 -Wall
hash.o:src/hash/hash.h src/hash/hash.c
gcc -c src/hash/hash.c
gcc -c src/hash/hash.c -O2 -Wall
clean:
rm -rfv include lib *.o *.a

View File

@ -2,6 +2,10 @@
#include "stack/stack.h"
#include <ctype.h>
extern unsigned int conf_hash_func1(const char *key);
extern unsigned int conf_hash_func2(const char *key);
extern int conf_hash_search(CONF_ARG *arg,char *key,CONF_VALUE **value);
//解析过程的各状态
enum conf_stat
{
@ -172,6 +176,8 @@ CONF_CREATER *conf_creater_new(const char *path)
creater->value=NULL;
creater->note=NULL;
creater->next=NULL;
return creater;
}
//插入一个参数到内存
@ -236,7 +242,7 @@ int conf_save(CONF_CREATER *creater)
void conf_free(CONF *conf)
{
int i;
int j;
//int j;
for(i=0;i != conf->size;++i)
{
@ -697,12 +703,12 @@ CONF_VALUE *conf_value_get(CONF *conf,const char *key)
* 使key
* NULL */
hash=conf_hash_func1(key)%conf->size;
if(conf_hash_search(&conf->hash_data[hash],key,&value))
if(conf_hash_search(&conf->hash_data[hash],(char *)key,&value))
return value;
else
{
hash=conf_hash_func2(key)%conf->size;
if(conf_hash_search(&conf->hash_data[hash],key,&value))
if(conf_hash_search(&conf->hash_data[hash],(char *)key,&value))
return value;
}

View File

@ -15,6 +15,7 @@
//#include "stack/stack.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//定义错误代码

View File

@ -12,3 +12,6 @@ V1.2 at 2014-10-12
2、添加conf_pos_msg_err接口控制是否在错误时打印信息
3、键名添加引号支持特殊键名
4、修复一些BUG
V1.3 at 2017-12-28
1、修复一些bug