After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 321695 - Unreachable code in xmlSwitchInputEncoding
Unreachable code in xmlSwitchInputEncoding
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.22
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-11-17 08:09 UTC by Oleksandr Kononenko
Modified: 2005-11-17 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleksandr Kononenko 2005-11-17 08:09:18 UTC
The function has two major parts - branches of the outermost IF. In the ELSE 
branch there is another IF with condition, which is always true, considering 
where it appears. Thus, a big portion of code in the ELSE part of the inner IF 
is effectively disabled. 

if (input->buf != NULL) {
   ...
   ...
} else {  
   // input->buf is NULL here!
   if ((input->length == 0) || (input->buf == NULL)) {
      ...
   } else {
      // UNREACHABLE BLOCK OF CODE
   }
}

Some compilers are smart enough to not compile unreached code (though not 
issuing a warning), but this fact is still worrying.
Comment 1 Daniel Veillard 2005-11-17 13:12:24 UTC
Okay, makes sense, I cleaned this up, this is commited in CVS.

 thanks !

Daniel