Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Iniparser
提交
b74397bc
T
Third Party Iniparser
项目概览
OpenHarmony
/
Third Party Iniparser
大约 1 年 前同步成功
通知
1
Star
24
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Iniparser
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b74397bc
编写于
3月 28, 2012
作者:
A
Andrey Mazo
提交者:
ndevilla
4月 04, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added const to all unmodified char* arguments.
上级
9f744cc3
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
29 deletion
+29
-29
src/dictionary.c
src/dictionary.c
+6
-6
src/dictionary.h
src/dictionary.h
+4
-4
src/iniparser.c
src/iniparser.c
+11
-11
src/iniparser.h
src/iniparser.h
+8
-8
未找到文件。
src/dictionary.c
浏览文件 @
b74397bc
...
...
@@ -41,7 +41,7 @@
/* Doubles the allocated size associated to a pointer */
/* 'size' is the current allocated size. */
static
void
*
mem_double
(
void
*
ptr
,
int
size
)
static
void
*
mem_double
(
const
void
*
ptr
,
int
size
)
{
void
*
newptr
;
...
...
@@ -64,7 +64,7 @@ static void * mem_double(void * ptr, int size)
for systems that do not have it.
*/
/*--------------------------------------------------------------------------*/
static
char
*
xstrdup
(
char
*
s
)
static
char
*
xstrdup
(
c
onst
c
har
*
s
)
{
char
*
t
;
if
(
!
s
)
...
...
@@ -91,7 +91,7 @@ static char * xstrdup(char * s)
by comparing the key itself in last resort.
*/
/*--------------------------------------------------------------------------*/
unsigned
dictionary_hash
(
char
*
key
)
unsigned
dictionary_hash
(
c
onst
c
har
*
key
)
{
int
len
;
unsigned
hash
;
...
...
@@ -178,7 +178,7 @@ void dictionary_del(dictionary * d)
dictionary object, you should not try to free it or modify it.
*/
/*--------------------------------------------------------------------------*/
char
*
dictionary_get
(
dictionary
*
d
,
char
*
key
,
char
*
def
)
char
*
dictionary_get
(
dictionary
*
d
,
c
onst
c
har
*
key
,
char
*
def
)
{
unsigned
hash
;
int
i
;
...
...
@@ -224,7 +224,7 @@ char * dictionary_get(dictionary * d, char * key, char * def)
This function returns non-zero in case of failure.
*/
/*--------------------------------------------------------------------------*/
int
dictionary_set
(
dictionary
*
d
,
c
har
*
key
,
char
*
val
)
int
dictionary_set
(
dictionary
*
d
,
c
onst
char
*
key
,
const
char
*
val
)
{
int
i
;
unsigned
hash
;
...
...
@@ -291,7 +291,7 @@ int dictionary_set(dictionary * d, char * key, char * val)
key cannot be found.
*/
/*--------------------------------------------------------------------------*/
void
dictionary_unset
(
dictionary
*
d
,
char
*
key
)
void
dictionary_unset
(
dictionary
*
d
,
c
onst
c
har
*
key
)
{
unsigned
hash
;
int
i
;
...
...
src/dictionary.h
浏览文件 @
b74397bc
...
...
@@ -72,7 +72,7 @@ typedef struct _dictionary_ {
by comparing the key itself in last resort.
*/
/*--------------------------------------------------------------------------*/
unsigned
dictionary_hash
(
char
*
key
);
unsigned
dictionary_hash
(
c
onst
c
har
*
key
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -112,7 +112,7 @@ void dictionary_del(dictionary * vd);
dictionary object, you should not try to free it or modify it.
*/
/*--------------------------------------------------------------------------*/
char
*
dictionary_get
(
dictionary
*
d
,
char
*
key
,
char
*
def
);
char
*
dictionary_get
(
dictionary
*
d
,
c
onst
c
har
*
key
,
char
*
def
);
/*-------------------------------------------------------------------------*/
...
...
@@ -141,7 +141,7 @@ char * dictionary_get(dictionary * d, char * key, char * def);
This function returns non-zero in case of failure.
*/
/*--------------------------------------------------------------------------*/
int
dictionary_set
(
dictionary
*
vd
,
c
har
*
key
,
char
*
val
);
int
dictionary_set
(
dictionary
*
vd
,
c
onst
char
*
key
,
const
char
*
val
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -154,7 +154,7 @@ int dictionary_set(dictionary * vd, char * key, char * val);
key cannot be found.
*/
/*--------------------------------------------------------------------------*/
void
dictionary_unset
(
dictionary
*
d
,
char
*
key
);
void
dictionary_unset
(
dictionary
*
d
,
c
onst
c
har
*
key
);
/*-------------------------------------------------------------------------*/
...
...
src/iniparser.c
浏览文件 @
b74397bc
...
...
@@ -48,7 +48,7 @@ typedef enum _line_status_ {
allocated, it will be modified at each function call (not re-entrant).
*/
/*--------------------------------------------------------------------------*/
static
char
*
strlwc
(
char
*
s
)
static
char
*
strlwc
(
c
onst
c
har
*
s
)
{
static
char
l
[
ASCIILINESZ
+
1
];
int
i
;
...
...
@@ -78,7 +78,7 @@ static char * strlwc(char * s)
(not re-entrant).
*/
/*--------------------------------------------------------------------------*/
static
char
*
strstrip
(
char
*
s
)
static
char
*
strstrip
(
c
onst
c
har
*
s
)
{
static
char
l
[
ASCIILINESZ
+
1
];
char
*
last
;
...
...
@@ -372,7 +372,7 @@ char ** iniparser_getseckeys(dictionary * d, char * s)
the dictionary, do not free or modify it.
*/
/*--------------------------------------------------------------------------*/
char
*
iniparser_getstring
(
dictionary
*
d
,
char
*
key
,
char
*
def
)
char
*
iniparser_getstring
(
dictionary
*
d
,
c
onst
c
har
*
key
,
char
*
def
)
{
char
*
lc_key
;
char
*
sval
;
...
...
@@ -412,7 +412,7 @@ char * iniparser_getstring(dictionary * d, char * key, char * def)
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int
iniparser_getint
(
dictionary
*
d
,
char
*
key
,
int
notfound
)
int
iniparser_getint
(
dictionary
*
d
,
c
onst
c
har
*
key
,
int
notfound
)
{
char
*
str
;
...
...
@@ -434,7 +434,7 @@ int iniparser_getint(dictionary * d, char * key, int notfound)
the notfound value is returned.
*/
/*--------------------------------------------------------------------------*/
double
iniparser_getdouble
(
dictionary
*
d
,
char
*
key
,
double
notfound
)
double
iniparser_getdouble
(
dictionary
*
d
,
c
onst
c
har
*
key
,
double
notfound
)
{
char
*
str
;
...
...
@@ -475,7 +475,7 @@ double iniparser_getdouble(dictionary * d, char * key, double notfound)
necessarily have to be 0 or 1.
*/
/*--------------------------------------------------------------------------*/
int
iniparser_getboolean
(
dictionary
*
d
,
char
*
key
,
int
notfound
)
int
iniparser_getboolean
(
dictionary
*
d
,
c
onst
c
har
*
key
,
int
notfound
)
{
char
*
c
;
int
ret
;
...
...
@@ -506,7 +506,7 @@ int iniparser_getboolean(dictionary * d, char * key, int notfound)
/*--------------------------------------------------------------------------*/
int
iniparser_find_entry
(
dictionary
*
ini
,
c
har
*
entry
c
onst
char
*
entry
)
{
int
found
=
0
;
...
...
@@ -529,7 +529,7 @@ int iniparser_find_entry(
It is Ok to set val to NULL.
*/
/*--------------------------------------------------------------------------*/
int
iniparser_set
(
dictionary
*
ini
,
c
har
*
entry
,
char
*
val
)
int
iniparser_set
(
dictionary
*
ini
,
c
onst
char
*
entry
,
const
char
*
val
)
{
return
dictionary_set
(
ini
,
strlwc
(
entry
),
val
)
;
}
...
...
@@ -544,7 +544,7 @@ int iniparser_set(dictionary * ini, char * entry, char * val)
If the given entry can be found, it is deleted from the dictionary.
*/
/*--------------------------------------------------------------------------*/
void
iniparser_unset
(
dictionary
*
ini
,
char
*
entry
)
void
iniparser_unset
(
dictionary
*
ini
,
c
onst
c
har
*
entry
)
{
dictionary_unset
(
ini
,
strlwc
(
entry
));
}
...
...
@@ -560,7 +560,7 @@ void iniparser_unset(dictionary * ini, char * entry)
*/
/*--------------------------------------------------------------------------*/
static
line_status
iniparser_line
(
char
*
input_line
,
c
onst
c
har
*
input_line
,
char
*
section
,
char
*
key
,
char
*
value
)
...
...
@@ -633,7 +633,7 @@ static line_status iniparser_line(
The returned dictionary must be freed using iniparser_freedict().
*/
/*--------------------------------------------------------------------------*/
dictionary
*
iniparser_load
(
char
*
ininame
)
dictionary
*
iniparser_load
(
c
onst
c
har
*
ininame
)
{
FILE
*
in
;
...
...
src/iniparser.h
浏览文件 @
b74397bc
...
...
@@ -159,7 +159,7 @@ char ** iniparser_getseckeys(dictionary * d, char * s);
the dictionary, do not free or modify it.
*/
/*--------------------------------------------------------------------------*/
char
*
iniparser_getstring
(
dictionary
*
d
,
char
*
key
,
char
*
def
);
char
*
iniparser_getstring
(
dictionary
*
d
,
c
onst
c
har
*
key
,
char
*
def
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -188,7 +188,7 @@ char * iniparser_getstring(dictionary * d, char * key, char * def);
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int
iniparser_getint
(
dictionary
*
d
,
char
*
key
,
int
notfound
);
int
iniparser_getint
(
dictionary
*
d
,
c
onst
c
har
*
key
,
int
notfound
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -203,7 +203,7 @@ int iniparser_getint(dictionary * d, char * key, int notfound);
the notfound value is returned.
*/
/*--------------------------------------------------------------------------*/
double
iniparser_getdouble
(
dictionary
*
d
,
char
*
key
,
double
notfound
);
double
iniparser_getdouble
(
dictionary
*
d
,
c
onst
c
har
*
key
,
double
notfound
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -237,7 +237,7 @@ double iniparser_getdouble(dictionary * d, char * key, double notfound);
necessarily have to be 0 or 1.
*/
/*--------------------------------------------------------------------------*/
int
iniparser_getboolean
(
dictionary
*
d
,
char
*
key
,
int
notfound
);
int
iniparser_getboolean
(
dictionary
*
d
,
c
onst
c
har
*
key
,
int
notfound
);
/*-------------------------------------------------------------------------*/
...
...
@@ -253,7 +253,7 @@ int iniparser_getboolean(dictionary * d, char * key, int notfound);
It is Ok to set val to NULL.
*/
/*--------------------------------------------------------------------------*/
int
iniparser_set
(
dictionary
*
ini
,
c
har
*
entry
,
char
*
val
);
int
iniparser_set
(
dictionary
*
ini
,
c
onst
char
*
entry
,
const
char
*
val
);
/*-------------------------------------------------------------------------*/
...
...
@@ -266,7 +266,7 @@ int iniparser_set(dictionary * ini, char * entry, char * val);
If the given entry can be found, it is deleted from the dictionary.
*/
/*--------------------------------------------------------------------------*/
void
iniparser_unset
(
dictionary
*
ini
,
char
*
entry
);
void
iniparser_unset
(
dictionary
*
ini
,
c
onst
c
har
*
entry
);
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -280,7 +280,7 @@ void iniparser_unset(dictionary * ini, char * entry);
of querying for the presence of sections in a dictionary.
*/
/*--------------------------------------------------------------------------*/
int
iniparser_find_entry
(
dictionary
*
ini
,
char
*
entry
)
;
int
iniparser_find_entry
(
dictionary
*
ini
,
c
onst
c
har
*
entry
)
;
/*-------------------------------------------------------------------------*/
/**
...
...
@@ -296,7 +296,7 @@ int iniparser_find_entry(dictionary * ini, char * entry) ;
The returned dictionary must be freed using iniparser_freedict().
*/
/*--------------------------------------------------------------------------*/
dictionary
*
iniparser_load
(
char
*
ininame
);
dictionary
*
iniparser_load
(
c
onst
c
har
*
ininame
);
/*-------------------------------------------------------------------------*/
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录