]> git.wincent.com - wikitext.git/commit
Silence a Clang warning about use of an uninitialized variable
authorWincent Colaiuta <win@wincent.com>
Sat, 16 Feb 2013 19:51:23 +0000 (11:51 -0800)
committerWincent Colaiuta <win@wincent.com>
Sat, 16 Feb 2013 19:53:27 +0000 (11:53 -0800)
commit6fe6ddb754d44d441c418cedb7d4236a69893f6b
tree31ea18636ae34d59263b5b9f6a32168aa809bf56
parent68e143ce8b5d9817b54138f18801033c633c7573
Silence a Clang warning about use of an uninitialized variable

  parser.c:350:14: warning: variable 'dest' is used uninitialized whenever 'if' condition is false
      else if ((src[0] & 0xf8) == 0xf0)
              ^~~~~~~~~~~~~~~~~~~~~~~
  parser.c:375:12: note: uninitialized use occurs here
      return dest;
            ^~~~
  parser.c:350:10: note: remove the 'if' if its condition is always true
      else if ((src[0] & 0xf8) == 0xf0)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  parser.c:307:18: note: initialize the variable 'dest' to silence this warning
      uint32_t dest;
                  ^
                    = 0

In this case the warning is spurious (the `else` branch raises an
exception, so it is not possible for `dest` to be used unuinitialized).
But Clang doesn't know that, so keep it happy by initializing the
variable every time.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/parser.c