From b930282e5daf29ee377feb4cd54314c8d61a8dee Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 3 Aug 2017 22:29:56 +0200 Subject: [PATCH] dump strvec --- lib/ecoli_strvec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/ecoli_strvec.c b/lib/ecoli_strvec.c index c50f4a6..7011cf3 100644 --- a/lib/ecoli_strvec.c +++ b/lib/ecoli_strvec.c @@ -161,14 +161,19 @@ void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec) size_t i; if (strvec == NULL) { - fprintf(out, "empty strvec\n"); + fprintf(out, "none\n"); return; } - fprintf(out, "strvec:\n"); - for (i = 0; i < ec_strvec_len(strvec); i++) - fprintf(out, " %zd: %s (refcnt=%d)\n", i, - strvec->vec[i]->str, strvec->vec[i]->refcnt); + fprintf(out, "strvec (len=%zu) [", strvec->len); + for (i = 0; i < ec_strvec_len(strvec); i++) { + if (i == 0) + fprintf(out, "%s", strvec->vec[i]->str); + else + fprintf(out, ", %s", strvec->vec[i]->str); + } + fprintf(out, "]\n"); + } /* XXX test case */ -- 2.39.5