On Thu, Apr 06, 2006 at 11:13:03AM +0200, Dominik Vogt wrote: > First, this code from style.c generates a warning: > > if (SID_GET_HAS_NAME(s_id) && (fw->style_name == NULL && > (matchWildcards(SID_GET_NAME(s_id), fw->class.res_class) == TRUE || > matchWildcards(SID_GET_NAME(s_id), fw->class.res_name) == TRUE || > matchWildcards(SID_GET_NAME(s_id), fw->name.name) == TRUE)) || > matchWildcards(SID_GET_NAME(s_id), fw->style_name ) == TRUE) > { > return True; > } > > style.c: In function `fw_match_style_id': > style.c:176: warning: suggest parentheses around && within || > > Second, the code may access a NULL pointer style_name if neither > of the first three matchWildcards is true. > > Also, I think even if style_name is not NULL, the usual style name > matching should be done: > > if (SID_GET_HAS_NAME(s_id)) > { > if (matchWildcards(SID_GET_NAME(s_id), fw->class.res_class) == > TRUE) > { > return True; > } > if (matchWildcards(SID_GET_NAME(s_id), fw->class.res_name) == > TRUE) > { > return True; > } > if (matchWildcards(SID_GET_NAME(s_id), fw->name.name) == TRUE) > { > return True; > } > if (fw->style_name == NULL && > matchWildcards(SID_GET_NAME(s_id), fw->class.res_class) == > TRUE) > { > return True; > } > }
(Note that multi-line conditions with mixed && and || operators are hard to read. If you happen to edit such a condition, please split it into separate conditions.) > (I have committed this code to CVS, but feel free to change it). Ciao Dominik ^_^ ^_^ -- Dominik Vogt, [EMAIL PROTECTED]
signature.asc
Description: Digital signature