Bug 229717 - src/lib/libefivar/efivar-dp-parse.c:344]: (style) Redundant condition
Summary: src/lib/libefivar/efivar-dp-parse.c:344]: (style) Redundant condition
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-12 10:05 UTC by David Binderman
Modified: 2018-07-12 14:55 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2018-07-12 10:05:31 UTC
src/lib/libefivar/efivar-dp-parse.c:344]: (style) Redundant condition: If 'EXPR == ' '', the comparison 'EXPR != 0' is always true.
[src/lib/libefivar/efivar-dp-parse.c:350]: (style) Redundant condition: If 'EXPR == '0'', the comparison 'EXPR != 0' is always true.

Source code is

  while ((*Str != 0) && *Str == ' ') {
    Str ++;
  }
  //
  // skip preceeding zeros
  //
  while ((*Str != 0) && *Str == '0') {

maybe better code

  while (*Str == ' ') {
    Str ++;
  }
  //
  // skip preceeding zeros
  //
  while (*Str == '0') {
Comment 1 Warner Losh freebsd_committer freebsd_triage 2018-07-12 14:55:39 UTC
This codes comes from EDK2, with as few local modifications as possible. We don't change this code unless there's a really really good reason so we can import again from EDK2 when the time comes.

Not sure what this warning comes from, but if it's the compiler, you should disable that warning for this code. We won't be changing it until the next upstream import, even if this is 100% a fair assessment of the code.