diff --git a/Makefile b/Makefile index 12f27cd..57d3999 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/conf.c b/src/conf.c index 2d9a146..9af5ec2 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2,6 +2,10 @@ #include "stack/stack.h" #include +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; } diff --git a/src/conf.h b/src/conf.h index 90e4c9c..037950e 100644 --- a/src/conf.h +++ b/src/conf.h @@ -15,6 +15,7 @@ //#include "stack/stack.h" #include #include +#include #include //定义错误代码 diff --git a/更新日志 b/更新日志 index 7cddaf2..6bce8e1 100644 --- a/更新日志 +++ b/更新日志 @@ -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