From e98a6bbafa76600bb6ff5f480851c36828e46726 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 12 May 2016 15:05:18 -0500 Subject: [PATCH] Make _NUM_CHOICES not an enum tag Fixes lp:1580972 --- src/tools/DBD/Menu.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/DBD/Menu.pm b/src/tools/DBD/Menu.pm index 65bae1526..9c93c6d50 100644 --- a/src/tools/DBD/Menu.pm +++ b/src/tools/DBD/Menu.pm @@ -62,10 +62,11 @@ sub toDeclaration { my @choices = map { sprintf " %-31s /* %s */", @{$_}[0], escapeCcomment(@{$_}[1]); } $this->choices; + my $num = scalar @choices; return "typedef enum {\n" . join(",\n", @choices) . - ",\n ${name}_NUM_CHOICES\n" . - "} $name;\n\n"; + "\n} $name;\n" . + "#define ${name}_NUM_CHOICES $num\n\n"; } sub toDefinition {