Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
4e20d89d
Commit
4e20d89d
authored
May 17, 2017
by
neil
Committed by
GitHub
May 17, 2017
Browse files
Merge pull request #851 from Neilpang/dev
fix for performance of _h2b() function
parents
375f6101
b420ec6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
4e20d89d
...
...
@@ -444,19 +444,27 @@ if [ "$(printf '\x41')" != 'A' ]; then
fi
_h2b() {
if _exists xxd; then
xxd -r -p
return
fi
hex=$(cat)
i=1
j=2
_debug3 _URGLY_PRINTF
"
$_URGLY_PRINTF
"
while
true
;
do
if
[
-z
"
$_URGLY_PRINTF
"
]
;
then
_debug2 _URGLY_PRINTF "$_URGLY_PRINTF"
if [ -z "$_URGLY_PRINTF" ]; then
while true; do
h="$(printf "%s" "$hex" | cut -c $i-$j)"
if [ -z "$h" ]; then
break
fi
printf "\x$h%s"
else
i="$(_math "$i" + 2)"
j="$(_math "$j" + 2)"
done
else
while true; do
ic="$(printf "%s" "$hex" | cut -c $i)"
jc="$(printf "%s" "$hex" | cut -c $j)"
if [ -z "$ic$jc" ]; then
...
...
@@ -465,12 +473,11 @@ _h2b() {
ic="$(_h_char_2_dec "$ic")"
jc="$(_h_char_2_dec "$jc")"
printf '\'"$(printf "%o" "$(_math "$ic" \* 16 + $jc)")""%s"
fi
i
=
"
$(
_math
"
$i
"
+ 2
)
"
j
=
"
$(
_math
"
$j
"
+ 2
)
"
i="$(_math "$i" + 2)"
j="$(_math "$j" + 2)"
done
fi
done
}
_is_solaris() {
...
...
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