Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0d487ceb
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0d487ceb
编写于
10月 20, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17500 from taosdata/fix/TD-19655-V26
fix(shell): coverity scan problem fixed
上级
a105f3ad
d28de946
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
40 deletion
+28
-40
src/kit/shell/src/shellAuto.c
src/kit/shell/src/shellAuto.c
+8
-18
src/kit/shell/src/tire.c
src/kit/shell/src/tire.c
+20
-22
未找到文件。
src/kit/shell/src/shellAuto.c
浏览文件 @
0d487ceb
...
@@ -533,26 +533,16 @@ void parseCommand(SWords * command, bool pattern) {
...
@@ -533,26 +533,16 @@ void parseCommand(SWords * command, bool pattern) {
}
}
// free Command
// free Command
void
freeCommand
(
SWords
*
command
)
{
void
freeCommand
(
SWords
*
command
)
{
SWord
*
word
=
command
->
head
;
SWord
*
item
=
command
->
head
;
if
(
word
==
NULL
)
{
// loop
return
;
while
(
item
)
{
}
SWord
*
tmp
=
item
;
item
=
item
->
next
;
// loop
while
(
word
->
next
)
{
SWord
*
tmp
=
word
;
word
=
word
->
next
;
// if malloc need free
// if malloc need free
if
(
tmp
->
free
&&
tmp
->
word
)
if
(
tmp
->
free
&&
tmp
->
word
)
free
(
tmp
->
word
);
free
(
tmp
->
word
);
free
(
tmp
);
free
(
tmp
);
}
}
// if malloc need free
if
(
word
->
free
&&
word
->
word
)
free
(
word
->
word
);
free
(
word
);
}
}
void
GenerateVarType
(
int
type
,
char
**
p
,
int
count
)
{
void
GenerateVarType
(
int
type
,
char
**
p
,
int
count
)
{
...
@@ -1178,11 +1168,11 @@ bool nextMatchCommand(TAOS * con, Command * cmd, SWords * firstMatch) {
...
@@ -1178,11 +1168,11 @@ bool nextMatchCommand(TAOS * con, Command * cmd, SWords * firstMatch) {
printScreen
(
con
,
cmd
,
match
);
printScreen
(
con
,
cmd
,
match
);
// free
// free
freeCommand
(
input
);
if
(
input
->
source
)
{
if
(
input
->
source
)
{
free
(
input
->
source
);
free
(
input
->
source
);
input
->
source
=
NULL
;
input
->
source
=
NULL
;
}
}
freeCommand
(
input
);
free
(
input
);
free
(
input
);
return
true
;
return
true
;
...
...
src/kit/shell/src/tire.c
浏览文件 @
0d487ceb
...
@@ -325,30 +325,26 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) {
...
@@ -325,30 +325,26 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) {
}
}
SMatch
*
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
)
{
SMatch
*
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
)
{
if
(
match
==
NULL
)
{
SMatch
*
rMatch
=
match
;
// define return match
match
=
(
SMatch
*
)
tmalloc
(
sizeof
(
SMatch
));
if
(
rMatch
==
NULL
)
{
memset
(
match
,
0
,
sizeof
(
SMatch
));
rMatch
=
(
SMatch
*
)
malloc
(
sizeof
(
SMatch
));
}
memset
(
rMatch
,
0
,
sizeof
(
SMatch
));
}
switch
(
tire
->
type
)
{
case
TIRE_TREE
:
switch
(
tire
->
type
)
{
matchPrefixFromTree
(
tire
,
prefix
,
match
);
case
TIRE_TREE
:
case
TIRE_LIST
:
matchPrefixFromTree
(
tire
,
prefix
,
rMatch
);
matchPrefixFromList
(
tire
,
prefix
,
match
);
break
;
default:
case
TIRE_LIST
:
break
;
matchPrefixFromList
(
tire
,
prefix
,
rMatch
);
}
break
;
default:
// return if need
break
;
if
(
match
->
count
==
0
)
{
}
freeMatch
(
match
);
match
=
NULL
;
return
rMatch
;
}
return
match
;
}
}
// get all items from tires tree
// get all items from tires tree
void
enumFromList
(
STire
*
tire
,
SMatch
*
match
)
{
void
enumFromList
(
STire
*
tire
,
SMatch
*
match
)
{
StrName
*
item
=
tire
->
head
;
StrName
*
item
=
tire
->
head
;
...
@@ -395,8 +391,10 @@ SMatch* enumAll(STire* tire) {
...
@@ -395,8 +391,10 @@ SMatch* enumAll(STire* tire) {
switch
(
tire
->
type
)
{
switch
(
tire
->
type
)
{
case
TIRE_TREE
:
case
TIRE_TREE
:
enumFromTree
(
tire
,
match
);
enumFromTree
(
tire
,
match
);
break
;
case
TIRE_LIST
:
case
TIRE_LIST
:
enumFromList
(
tire
,
match
);
enumFromList
(
tire
,
match
);
break
;
default:
default:
break
;
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录