Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A few small code cleanups. Fix t/op/sprintf.t, since it is wonderfull…

…y matching on the exact text of the exception message, which is changing for GH #759
  • Loading branch information...
commit 3fc09774d758efc45e1b39a4ddb98381190f7f8c 1 parent 5a39275
@Whiteknight Whiteknight authored
Showing with 17 additions and 13 deletions.
  1. +16 −12 src/string/spf_render.c
  2. +1 −1  t/op/sprintf.t
View
28 src/string/spf_render.c
@@ -334,24 +334,28 @@ canonicalize_exponent(ARGMOD(char *tc), ARGIN(const SpfInfo *info))
/* Scan the formatted number backward to find the positions of the
last digit, leftmost non-0 exponent digit, sign, and E. */
-
for (i = len-1; i >= 0 && e_pos == 0; --i) {
switch (tc[i]) {
case '1': case '2': case '3':
case '4': case '5': case '6':
- case '7': case '8': case '9': non0_pos = i;
- /* fall through */
+ case '7': case '8': case '9':
+ non0_pos = i;
+ /* fall through */
- case '0': if (last_pos == len) last_pos = i;
- break;
+ case '0':
+ if (last_pos == len) last_pos = i;
+ break;
- case '+': case '-': sign_pos = i;
- break;
+ case '+': case '-':
+ sign_pos = i;
+ break;
- case 'E': case 'e': e_pos = i;
- break;
+ case 'E': case 'e':
+ e_pos = i;
+ break;
- default: break;
+ default:
+ break;
}
}
@@ -367,8 +371,8 @@ canonicalize_exponent(ARGMOD(char *tc), ARGIN(const SpfInfo *info))
adjust the length. Don't forget to move the NUL. */
const size_t keep = (last_pos - non0_pos + 1 > exp_digits)
- ? len - non0_pos
- : exp_digits + (len - last_pos - 1);
+ ? len - non0_pos
+ : exp_digits + (len - last_pos - 1);
memmove(&tc[sign_pos+1], &tc[len - keep], keep+1);
len = sign_pos + 1 + keep;
View
2  t/op/sprintf.t
@@ -249,7 +249,7 @@ tag C<all> is allowed for todo tests that should fail on any system.
.local string message
get_results '0', exception
message = exception
- $I0 = index message, 'is not a valid sprintf format'
+ $I0 = index message, 'is not valid in sprintf format sequence'
if $I0 == -1 goto other_error
$I0 = index expected, ' INVALID'
if $I0 == -1 goto bad_error
Please sign in to comment.
Something went wrong with that request. Please try again.