diff options
Diffstat (limited to 'apps/plugins/lib/button_helper.pl')
-rwxr-xr-x | apps/plugins/lib/button_helper.pl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/plugins/lib/button_helper.pl b/apps/plugins/lib/button_helper.pl index 45c3fd9073..192df18d7f 100755 --- a/apps/plugins/lib/button_helper.pl +++ b/apps/plugins/lib/button_helper.pl | |||
@@ -26,12 +26,15 @@ my @buttons = (); | |||
26 | my $count = 1; #null sentinel | 26 | my $count = 1; #null sentinel |
27 | my $val; | 27 | my $val; |
28 | my $def; | 28 | my $def; |
29 | my $len_max_button = 0; | ||
29 | while(my $line = <STDIN>) | 30 | while(my $line = <STDIN>) |
30 | { | 31 | { |
31 | chomp($line); | 32 | chomp($line); |
32 | if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) | 33 | if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) |
33 | { | 34 | { |
34 | $def = "{\"$1\", $2},\n"; | 35 | $def = "{\"$1\", $2},\n"; |
36 | my $slen = length($1) + 1; # NULL terminator | ||
37 | if ($slen > $len_max_button) { $len_max_button = $slen; } | ||
35 | $val = $2; | 38 | $val = $2; |
36 | if($val =~ /^0/) | 39 | if($val =~ /^0/) |
37 | { | 40 | { |
@@ -53,6 +56,8 @@ print <<EOF | |||
53 | #include "button.h" | 56 | #include "button.h" |
54 | #include "button_helper.h" | 57 | #include "button_helper.h" |
55 | 58 | ||
59 | const size_t button_helper_maxbuffer = $len_max_button; | ||
60 | |||
56 | static const struct available_button buttons[$count] = { | 61 | static const struct available_button buttons[$count] = { |
57 | EOF | 62 | EOF |
58 | ; | 63 | ; |