From c99a32eccd9e3101393d5521d40719202a08d3ca Mon Sep 17 00:00:00 2001 From: Daniel Elstner Date: Mon, 27 Nov 2006 18:22:22 +0000 Subject: Break the loop if the length of the common prefix reaches zero. This fixes * tools/enum.pl (form_names): Break the loop if the length of the common prefix reaches zero. This fixes the infinite loop when processing the inconsistently named enumeration constants of the Hildon libraries. --- ChangeLog | 7 +++++++ tools/enum.pl | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 25a6b1f6..1d848f83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-27 Daniel Elstner + + * tools/enum.pl (form_names): Break the loop if the length of the + common prefix reaches zero. This fixes the infinite loop when + processing the inconsistently named enumeration constants of the + Hildon libraries. + 2006-11-22 Oliver Nittka * glib/src/value_basictypes.cc.m4: When registering float parameters, diff --git a/tools/enum.pl b/tools/enum.pl index df41545d..dd35dc3c 100644 --- a/tools/enum.pl +++ b/tools/enum.pl @@ -4,6 +4,7 @@ # thus we must extract it ourselves. # Usage: ./enum.pl /gnome/head/cvs/gconf/gconf/*.h > gconf_enums.defs +use warnings; my %token; $module="none"; @@ -207,12 +208,14 @@ sub form_names my $len=length($$c_name[0]) - 1; my $j; - for ($j=0;$j<$#c_name;$j++) + + NAME: for ($j=0;$j<$#c_name;$j++) { while (substr($$c_name[$j],$len-1,1) ne "_" || substr($$c_name[$j],0,$len) ne substr($$c_name[$j+1],0,$len)) { $len--; + last NAME if ($len <= 0); } #print substr($$c_name[$j],0,$len),"\n"; } -- cgit v1.2.1