summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2012-11-04 09:32:23 -0800
committerRuss Allbery <rra@stanford.edu>2012-11-04 09:32:23 -0800
commit5af748e6ab1dde5eb48c5316ca572be774fc5b77 (patch)
treed08f21ca22b5ab6ccf7f1f439b620b7612dcd35f /tests
parentd2b811335137ad10ca9489582f31d2d5c595f7f7 (diff)
Adjust test suite to remove unused variables
Diffstat (limited to 'tests')
-rw-r--r--tests/portable/snprintf-t.c3
-rwxr-xr-xtests/util/xmalloc-t8
-rw-r--r--tests/util/xmalloc.c6
3 files changed, 7 insertions, 10 deletions
diff --git a/tests/portable/snprintf-t.c b/tests/portable/snprintf-t.c
index fd4c228..4b64f5b 100644
--- a/tests/portable/snprintf-t.c
+++ b/tests/portable/snprintf-t.c
@@ -110,7 +110,7 @@ test_format(bool trunc, const char *expected, int count,
int
main(void)
{
- int n, i, count;
+ int i, count;
unsigned int j;
long lcount;
char lgbuf[128];
@@ -153,7 +153,6 @@ main(void)
is_int(31, lcount, "correct output from long %%ln");
test_format(true, "(null)", 6, "%s", NULL);
- n = 26;
for (i = 0; fp_formats[i] != NULL; i++)
for (j = 0; j < ARRAY_SIZE(fp_nums); j++) {
count = sprintf(lgbuf, fp_formats[i], fp_nums[j]);
diff --git a/tests/util/xmalloc-t b/tests/util/xmalloc-t
index 02f54b5..67d95f6 100755
--- a/tests/util/xmalloc-t
+++ b/tests/util/xmalloc-t
@@ -95,10 +95,10 @@ ok_xmalloc "calloc fail" 1 \
"failed to calloc 3500000 bytes at xmalloc.c line 148" \
"c" "3500000" "3500000"
ok_xmalloc "asprintf fail" 1 \
- "failed to asprintf 3500000 bytes at xmalloc.c line 173" \
+ "failed to asprintf 3500000 bytes at xmalloc.c line 172" \
"a" "3500000" "3500000"
ok_xmalloc "vasprintf fail" 1 \
- "failed to vasprintf 3500000 bytes at xmalloc.c line 193" \
+ "failed to vasprintf 3500000 bytes at xmalloc.c line 192" \
"v" "3500000" "3500000"
# Check our custom error handler.
@@ -112,9 +112,9 @@ ok_xmalloc "strndup custom" 1 "strndup 3500000 xmalloc.c 124" \
"N" "3500000" "3500000"
ok_xmalloc "calloc custom" 1 "calloc 3500000 xmalloc.c 148" \
"C" "3500000" "3500000"
-ok_xmalloc "asprintf custom" 1 "asprintf 3500000 xmalloc.c 173" \
+ok_xmalloc "asprintf custom" 1 "asprintf 3500000 xmalloc.c 172" \
"A" "3500000" "3500000"
-ok_xmalloc "vasprintf custom" 1 "vasprintf 3500000 xmalloc.c 193" \
+ok_xmalloc "vasprintf custom" 1 "vasprintf 3500000 xmalloc.c 192" \
"V" "3500000" "3500000"
# Check the smaller ones again just for grins.
diff --git a/tests/util/xmalloc.c b/tests/util/xmalloc.c
index b6f4564..c37396e 100644
--- a/tests/util/xmalloc.c
+++ b/tests/util/xmalloc.c
@@ -177,13 +177,12 @@ static int
test_asprintf(size_t size)
{
char *copy, *string;
- int status;
size_t i;
string = xmalloc(size);
memset(string, 42, size - 1);
string[size - 1] = '\0';
- status = xasprintf(&copy, "%s", string);
+ xasprintf(&copy, "%s", string);
free(string);
for (i = 0; i < size - 1; i++)
if (copy[i] != 42)
@@ -217,13 +216,12 @@ static int
test_vasprintf(size_t size)
{
char *copy, *string;
- int status;
size_t i;
string = xmalloc(size);
memset(string, 42, size - 1);
string[size - 1] = '\0';
- status = xvasprintf_wrapper(&copy, "%s", string);
+ xvasprintf_wrapper(&copy, "%s", string);
free(string);
for (i = 0; i < size - 1; i++)
if (copy[i] != 42)