Re: gmc and icons and command bindings



On Mon, Jan 25, 1999 at 06:40:03PM -0600, Miguel de Icaza wrote:
> > All the mime-types and extensions are added with prio "0".
> > The for-loop in the above function first checks the hash_table
> > for prio 1, so nothing is found. Then it checks the regexec()
> > which has a match, but no mime-types.
> 
> I do not understand how this makes any difference.
> 
> The gnome_mime_type_or_default only figures out a mime-type out from a
> filename.  Splitting the loop in two pieces would do just the same.

No, ist does not do the same.
As far as I tracked it down, all the specs were added to the hash_table
with a prio of "0".

As the function gets called the for loop first checks for prio 1.
There is nothing in the hash_table so the loop reaches the regexp
test. The regexp test returns a match, but that is empty :-(
The function returns, but it does not return a mime-type.

Splitting the loop in two loops the hash_table is first examined
with a prio of "1" and if there is no match with a prio of "0"
which reveals a match which the functions returns.
The regexp match (at any prio) is only tested if there wasn't any
match in the hash_table.

I tracked that down debugging the hash_table code (*argh*) and noticed
that only prio 0 gets added to the hash_table. However I admit I did
not debug the regexec code to see where the empty match (at prio 1) comes
from. I split the loop and it worked great ;-)
Besides that I did not change anything ...

	\Maex

-- 
SpaceNet GmbH             |   http://www.Space.Net/   | In a world without
Research & Development    | mailto:maex-sig@Space.Net |   walls and fences,
Joseph-Dollinger-Bogen 14 |  Tel: +49 (89) 32356-0    | who needs
D-80807 Muenchen          |  Fax: +49 (89) 32356-299  |   Windows and Gates? 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]