Function wDefaultFillAttributes() rewritten
commitc61e5bfeb8a036191e1a2517b694d05b7c871900
authorRodolfo García Peñas (kix) <kix@kix.es>
Wed, 6 Jun 2012 05:50:05 +0000 (6 07:50 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 9 Jun 2012 15:48:58 +0000 (9 16:48 +0100)
tree8d234b492225869d62819b1abced69c04a956607
parent32fe186c54eefbee60d856288a07c6dbcbd8f687
Function wDefaultFillAttributes() rewritten

The function wDefaultFillAttributes can be changed a lot:

1. Initialitation to NULL: If the pointers are initialized to NULL
   then, the "if's" don't need the else block:

   WMPropList *value, *dw, *dc, *dn, *da;
   dw = dc = dn = da = NULL;

   if's:

   = if (instance)
   =     key2 = WMCreatePLString(instance);
   - else
   -     key2 = NULL;

2. Added StrConcatDot in the class + instance block:

   = if (class && instance) {
   +     buffer = StrConcatDot(instance, class);
   -     buffer = wmalloc(strlen(class) + strlen(instance) + 2);
   -     sprintf(buffer, "%s.%s", instance, class);

3. init_wdefaults(scr); moved above. This function is used only
   to load the default value "AnyWindow" (value "*"), to search
   the default value. Can be moved above without problems.

4. Preprocessor code of APPLY_VAL moved to the top of the file.

5. New function get_value_from_instanceclass() to do the rest of
   the (repetitive) code. This function is called to create the
   proplist, search the value, and return the proplist.

EXTRA:

1. Added StrConcatDot (like dot 2) in wDefaultChangeIcon()
2. Added a comment in get_value()
src/wdefaults.c