Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8b26a521
提交
8b26a521
authored
5月 05, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1377
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
3058335e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
4 行删除
+6
-4
switch_xml.h
src/include/switch_xml.h
+1
-0
switch_xml.c
src/switch_xml.c
+5
-4
没有找到文件。
src/include/switch_xml.h
浏览文件 @
8b26a521
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
BEGIN_EXTERN_C
BEGIN_EXTERN_C
#define SWITCH_XML_BUFSIZE 1024 // size of internal memory buffers
#define SWITCH_XML_BUFSIZE 1024 // size of internal memory buffers
#define SWITCH_XML_NAMEM 0x80 // name is malloced
#define SWITCH_XML_NAMEM 0x80 // name is malloced
#define SWITCH_XML_TXTM 0x40 // txt is malloced
#define SWITCH_XML_TXTM 0x40 // txt is malloced
#define SWITCH_XML_DUP 0x20 // attribute name and value are strduped
#define SWITCH_XML_DUP 0x20 // attribute name and value are strduped
...
...
src/switch_xml.c
浏览文件 @
8b26a521
...
@@ -37,7 +37,8 @@ struct switch_xml_root { // additional data for the root tag
...
@@ -37,7 +37,8 @@ struct switch_xml_root { // additional data for the root tag
struct
switch_xml
xml
;
// is a super-struct built on top of switch_xml struct
struct
switch_xml
xml
;
// is a super-struct built on top of switch_xml struct
switch_xml_t
cur
;
// current xml tree insertion point
switch_xml_t
cur
;
// current xml tree insertion point
char
*
m
;
// original xml string
char
*
m
;
// original xml string
size_t
len
;
// length of allocated memory for mmap, -1 for malloc
switch_size_t
len
;
// length of allocated memory for mmap
uint8_t
dynamic
;
char
*
u
;
// UTF-8 conversion of string if original was UTF-16
char
*
u
;
// UTF-8 conversion of string if original was UTF-16
char
*
s
;
// start of work area
char
*
s
;
// start of work area
char
*
e
;
// end of work area
char
*
e
;
// end of work area
...
@@ -610,7 +611,7 @@ switch_xml_t switch_xml_parse_fp(FILE *fp)
...
@@ -610,7 +611,7 @@ switch_xml_t switch_xml_parse_fp(FILE *fp)
if
(
!
s
)
return
NULL
;
if
(
!
s
)
return
NULL
;
root
=
(
switch_xml_root_t
)
switch_xml_parse_str
(
s
,
len
);
root
=
(
switch_xml_root_t
)
switch_xml_parse_str
(
s
,
len
);
root
->
len
=
-
1
;
// so we know to free s in switch_xml_free()
root
->
dynamic
=
1
;
// so we know to free s in switch_xml_free()
return
&
root
->
xml
;
return
&
root
->
xml
;
}
}
...
@@ -639,7 +640,7 @@ switch_xml_t switch_xml_parse_fd(int fd)
...
@@ -639,7 +640,7 @@ switch_xml_t switch_xml_parse_fd(int fd)
#endif // HAVE_MMAP
#endif // HAVE_MMAP
l
=
read
(
fd
,
m
=
malloc
(
st
.
st_size
),
st
.
st_size
);
l
=
read
(
fd
,
m
=
malloc
(
st
.
st_size
),
st
.
st_size
);
root
=
(
switch_xml_root_t
)
switch_xml_parse_str
(
m
,
l
);
root
=
(
switch_xml_root_t
)
switch_xml_parse_str
(
m
,
l
);
root
->
len
=
-
1
;
// so we know to free s in switch_xml_free()
root
->
dynamic
=
1
;
// so we know to free s in switch_xml_free()
#ifdef HAVE_MMAP
#ifdef HAVE_MMAP
}
}
#endif // HAVE_MMAP
#endif // HAVE_MMAP
...
@@ -804,7 +805,7 @@ void switch_xml_free(switch_xml_t xml)
...
@@ -804,7 +805,7 @@ void switch_xml_free(switch_xml_t xml)
}
}
if
(
root
->
pi
[
0
])
free
(
root
->
pi
);
// free processing instructions
if
(
root
->
pi
[
0
])
free
(
root
->
pi
);
// free processing instructions
if
(
root
->
len
==
-
1
)
free
(
root
->
m
);
// malloced xml data
if
(
root
->
dynamic
==
1
)
free
(
root
->
m
);
// malloced xml data
#ifdef HAVE_MMAP
#ifdef HAVE_MMAP
else
if
(
root
->
len
)
munmap
(
root
->
m
,
root
->
len
);
// mem mapped xml data
else
if
(
root
->
len
)
munmap
(
root
->
m
,
root
->
len
);
// mem mapped xml data
#endif // HAVE_MMAP
#endif // HAVE_MMAP
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论