Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : Redundant Condition  at settings.c:489

Categories: LANG.STRUCT.RC CWE:570 CWE:571
Warning ID: 2093.2094
Procedure: backwards_compatibility
Trace: View
Modified: Wed Sep 2 11:51:10 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /u1/paul/SATE/2010/c/irssi/irssi-0.8.14/src/core/settings.c
   Enter backwards_compatibility
 451 static int backwards_compatibility(const char *module, CONFIG_NODE *node,
 452                                    CONFIG_NODE *parent) 
 453 {
 454         const char *new_key, *new_module;
 455         CONFIG_NODE *new_node;
 456         char *new_value;
 457  
 458         new_value = NULL; new_key = NULL; new_module = NULL;
 459  
 460         /* fe-text term_type -> fe-common/core term_charset - for 0.8.10-> */ 
 461         if (strcmp(module, "fe-text") == 0) {
 462                 if (g_ascii_strcasecmp(node->key, "term_type") == 0 ||
 463                     /* kludge for cvs-version where term_charset was in fe-text */ 
 464                     g_ascii_strcasecmp(node->key, "term_charset") == 0) {
 465                         new_module = "fe-common/core";
 466                         new_key = "term_charset";
 467                         new_value = !is_valid_charset(node->value) ? NULL : 
 468                                 g_strdup(node->value);
 469                         new_node = iconfig_node_traverse("settings", FALSE);
 470                         new_node = new_node == NULL ? NULL : 
 471                                 config_node_section(new_node, new_module, -1);
 472  
 473                         config_node_set_str(mainconfig, new_node,
 474                                             new_key, new_value);
 475                         /* remove old */ 
 476                         config_node_set_str(mainconfig, parent,
 477                                             node->key, NULL);
 478                         g_free(new_value);
 479                         config_changed = TRUE;
 480                         return new_key != NULL;
 481                 } else if (g_ascii_strcasecmp(node->key, "actlist_moves") == 0 &&
 482                            node->value != NULL && g_ascii_strcasecmp(node->value, "yes") == 0) {
 483                         config_node_set_str(mainconfig, parent, "actlist_sort", "recent");
 484                         config_node_set_str(mainconfig, parent, node->key, NULL);
 485                         config_changed = TRUE;
 486                         return TRUE;
 487                 }
 488         }
Never True: new_key != (void*)0489         return new_key != NULL;     /* Redundant Condition */
 490 




Change Warning 2093.2094 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: