Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dcs_classifier
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
dcs_classifier
Commits
d8f118f9
Commit
d8f118f9
authored
Aug 07, 2015
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix and streamline test token generation for keys with negative matches
parent
f0b62e19
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
dcs_test.c
src/dcs_test.c
+29
-17
No files found.
src/dcs_test.c
View file @
d8f118f9
...
...
@@ -206,16 +206,8 @@ test (const char *fixup_remove_name, const char *fixup_reorder_name) {
char
n1
[
KEYLIM
],
n2
[
KEYLIM
];
char
*
save
;
if
(
poskey
[
0
]
==
'!'
)
{
poskey
=
strchr
(
poskey
+
1
,
'*'
);
assert
(
poskey
);
poskey
++
;
assert
(
*
poskey
);
negkey
++
;
}
if
(
strstr
(
poskey
,
"*!"
))
{
if
(
poskey
[
0
]
==
'!'
||
strstr
(
poskey
,
"*!"
))
{
const
char
*
pp
,
*
np
;
assert
(
strlen
(
poskey
)
<
KEYLIM
);
...
...
@@ -224,26 +216,46 @@ test (const char *fixup_remove_name, const char *fixup_reorder_name) {
strcpy
(
p1
,
poskey
);
strcpy
(
n1
,
negkey
);
pp
=
strtok_r
(
p1
,
"*"
,
&
save
);
/* extract only positive tokens */
*
p2
=
'\0'
;
poskey
=
p2
;
while
(
pp
)
{
if
(
*
pp
!=
'!'
)
{
if
((
pp
=
strtok_r
(
p1
,
"*"
,
&
save
)))
{
while
(
pp
&&
*
pp
==
'!'
)
pp
=
strtok_r
(
NULL
,
"*"
,
&
save
);
if
(
pp
)
strcat
(
p2
,
pp
);
while
((
pp
=
strtok_r
(
NULL
,
"*"
,
&
save
)))
{
if
(
*
pp
==
'!'
)
continue
;
strcat
(
p2
,
"*"
);
strcat
(
p2
,
pp
);
}
pp
=
strtok_r
(
NULL
,
"*"
,
&
save
);
}
np
=
strtok_r
(
n1
,
"*"
,
&
save
);
/* extract negative tokens also */
*
n2
=
'\0'
;
negkey
=
n2
;
while
(
np
)
{
if
((
np
=
strtok_r
(
n1
,
"*"
,
&
save
)))
{
if
(
*
np
==
'!'
)
np
++
;
strcat
(
n2
,
np
);
np
=
strtok_r
(
NULL
,
"*"
,
&
save
);
while
((
np
=
strtok_r
(
NULL
,
"*"
,
&
save
)))
{
if
(
*
np
==
'!'
)
np
++
;
strcat
(
n2
,
"*"
);
strcat
(
n2
,
np
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment