this is simpler code



Taken from gtkitemfactory.c.  Shouldn't the following snippet of code:

  if (scanner->token == G_TOKEN_SYMBOL)
    {
      guint (*parser_func) (GScanner*, GtkItemFactoryClass*);

      parser_func = scanner->value.v_symbol;

      /* check whether this is a GtkItemFactory symbol.
       */
      if (parser_func == gtk_item_factory_parse_menu_path)
	expected_token = parser_func (scanner, class);
      else
	expected_token = G_TOKEN_SYMBOL;
    }

look like this instead:

  if (scanner->token == G_TOKEN_SYMBOL)
    {
      /* check whether this is a GtkItemFactory symbol.
       */
      if (scanner->value.v_symbol == gtk_item_factory_parse_menu_path)
	expected_token = gtk_item_factory_parse_menu_path (scanner, class);
      else
	expected_token = G_TOKEN_SYMBOL;
    }

?  Why bother with parser_func, when removing it makes the code
simpler and easier to understand?

-- 
-russ nelson <nelson@crynwr.com>  http://russnelson.com
Crynwr sells support for free software  | PGPok | Government schools are so
521 Pleasant Valley Rd. | +1 315 268 1925 voice | bad that any rank amateur
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | can outdo them. Homeschool!



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