Bug 501365 - dead error condition in theme-parser.c
dead error condition in theme-parser.c
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: themes
trunk
Other Linux
: Normal normal
: 2.21.3
Assigned To: Metacity maintainers list
Metacity maintainers list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-12-03 20:58 UTC by Kjartan Maraas
Modified: 2008-03-18 02:46 UTC (History)
1 user (show)

See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments

Description Kjartan Maraas 2007-12-03 20:58:21 UTC
The following code around line 377 in theme-parser.c looks wrong:

  retval = TRUE;

  n_attrs = 1;
  attrs[0].name = first_attribute_name;
  attrs[0].retloc = first_attribute_retloc;
  *first_attribute_retloc = NULL;

  va_start (args, first_attribute_retloc);

  name = va_arg (args, const char*);
  retloc = va_arg (args, const char**);

  while (name != NULL)
    {
      g_return_val_if_fail (retloc != NULL, FALSE);

      g_assert (n_attrs < MAX_ATTRS);

      attrs[n_attrs].name = name;
      attrs[n_attrs].retloc = retloc;
      n_attrs += 1;
      *retloc = NULL;

      name = va_arg (args, const char*);
      retloc = va_arg (args, const char**);
    }

  va_end (args);

  if (!retval)
    return retval;

retval can never be FALSE here.
Comment 1 Thomas Thurman 2007-12-11 16:08:12 UTC
Examination of the places locate_attributes() is called shows that its return value is expected to be true iff there was an error set (a required attribute was not found, an attribute was specified twice, an unknown attribute was specified). In this case there is no error and so these lines should be removed. I'll do it this evening if you like.
Comment 2 Thomas Thurman 2007-12-12 02:27:12 UTC
Fixed.

Note You need to log in before you can comment on or make changes to this bug.