Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobcode
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
libvmod-blobcode
Commits
38346b3e
Commit
38346b3e
authored
Feb 08, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak hex_decode some more, so that it's now all inlined
parent
1b2e9060
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
33 deletions
+18
-33
hex.c
src/hex.c
+18
-33
No files found.
src/hex.c
View file @
38346b3e
...
...
@@ -54,35 +54,6 @@ static const uint8_t nibble[] = {
11
,
12
,
13
,
14
,
15
};
static
inline
int
isxstr
(
const
char
*
const
p
,
ssize_t
*
l
)
{
const
char
*
s
=
p
;
while
(
*
s
)
if
(
!
isxdigit
(
*
s
++
))
return
0
;
else
*
l
+=
1
;
return
1
;
}
static
inline
ssize_t
check
(
const
char
*
const
p
,
va_list
ap
)
{
ssize_t
len
=
0
;
va_list
ap2
;
va_copy
(
ap2
,
ap
);
for
(
const
char
*
s
=
p
;
s
!=
vrt_magic_string_end
;
s
=
va_arg
(
ap2
,
const
char
*
))
if
(
s
!=
NULL
&&
*
s
!=
'\0'
&&
!
isxstr
(
s
,
&
len
))
{
len
=
-
1
;
break
;
}
va_end
(
ap2
);
return
len
;
}
static
inline
char
hex2byte
(
const
unsigned
char
hi
,
const
unsigned
char
lo
)
{
...
...
@@ -121,15 +92,29 @@ hex_decode(const enum encoding dec, char *restrict const buf,
{
char
*
dest
=
buf
;
unsigned
char
extranib
=
0
;
ssize_t
len
;
ssize_t
len
=
0
;
va_list
ap2
;
AN
(
buf
);
assert
(
dec
==
HEX
);
if
(
p
==
vrt_magic_string_end
)
return
0
;
va_copy
(
ap2
,
ap
);
for
(
const
char
*
s
=
p
;
s
!=
vrt_magic_string_end
;
s
=
va_arg
(
ap2
,
const
char
*
))
{
const
char
*
b
=
s
;
if
(
s
!=
NULL
)
while
(
*
s
)
if
(
!
isxdigit
(
*
s
++
))
{
len
=
-
1
;
break
;
}
if
(
len
==
-
1
)
break
;
len
+=
s
-
b
;
}
va_end
(
ap2
);
if
(
(
len
=
check
(
p
,
ap
))
==
0
)
if
(
len
==
0
)
return
0
;
if
(
len
==
-
1
)
{
errno
=
EINVAL
;
...
...
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