From 5671fce1118cc294310ec45a1e16614c94845b28 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 3 Jan 2002 12:43:01 +0000 Subject: [PATCH] Fix final comma in arrays. --- lib/format_text/export.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/format_text/export.c b/lib/format_text/export.c index 278c55e26..819fc26e9 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -82,7 +82,6 @@ static void _out_with_comment(struct formatter *f, const char *comment, white_space[i] = '\t'; white_space[i] = '\0'; fprintf(f->fp, white_space); - i = vfprintf(f->fp, fmt, ap); if (comment) { @@ -184,8 +183,7 @@ static int _print_header(struct formatter *f, struct volume_group *vg) _out(f, "# This file was originally generated by the LVM2 library\n" - "# It is inadvisable for people to edit this by hand unless\n" - "# they know what they're doing.\n" + "# It is inadvisable to edit this file.\n" "# Generated: %s\n", ctime(&t)); return 1; } @@ -280,7 +278,7 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg) } static int _print_segment(struct formatter *f, struct volume_group *vg, - int count, struct stripe_segment *seg, int last) + int count, struct stripe_segment *seg) { int s; const char *name; @@ -307,7 +305,7 @@ static int _print_segment(struct formatter *f, struct volume_group *vg, } _out(f, "\"%s\", %u%s", name, seg->area[s].pe, - last ? "" : ","); + (s == seg->stripes - 1) ? "" : ","); } _dec_indent(f); @@ -362,8 +360,7 @@ static int _print_lvs(struct formatter *f, struct volume_group *vg) list_iterate (segh, &lv->segments) { seg = list_item(segh, struct stripe_segment); - if (!_print_segment(f, vg, seg_count++, seg, - (segh->n == &lv->segments))) { + if (!_print_segment(f, vg, seg_count++, seg)) { stack; return 0; } -- 2.43.5