diff mbox series

[LEDE-DEV,uci,2/2] list: remove unncessary increment of n_section (FS#1182)

Message ID 1513853792-15138-2-git-send-email-dedeckeh@gmail.com
State Accepted
Delegated to: Hans Dedecker
Headers show
Series [LEDE-DEV,uci,1/2] file: remove unnecessary uci_fixup_section calls | expand

Commit Message

Hans Dedecker Dec. 21, 2017, 10:56 a.m. UTC
The package n_section counter is already incremented in uci_alloc_section;
so no need to increment it again in uci_fixup_section.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
---
Output of uci -n export foo before the fix

package foo
config foo 'cfg027389'
config foo 'cfg047389'
config bar 'cfg0660ba'
config bar 'cfg0860ba'

after the fix

package foo
config foo 'cfg017389'
config foo 'cfg027389'
config bar 'cfg0360ba'
config bar 'cfg0460ba'

 list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/list.c b/list.c
index e78012b..0347138 100644
--- a/list.c
+++ b/list.c
@@ -175,7 +175,7 @@  static void uci_fixup_section(struct uci_context *ctx, struct uci_section *s)
 			break;
 		}
 	}
-	sprintf(buf, "cfg%02x%04x", ++s->package->n_section, hash % (1 << 16));
+	sprintf(buf, "cfg%02x%04x", s->package->n_section, hash % (1 << 16));
 	s->e.name = uci_strdup(ctx, buf);
 }