Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Shut up erroneous warnings about use of 'val' while uninitialized.
Matthew Seaman committed 12 years ago
commit 98c4192d4d4c4276164aaf3dd0c6585e59f0b5a0
parent 241e1c5
1 file changed +9 -2
modified libpkg/pkg_printf.c
@@ -2329,13 +2329,13 @@ parse_format(const char *f, unsigned context, struct percent_esc *p)
const char*
maybe_read_hex_byte(struct sbuf *sbuf, const char *f)
{
-
	int	val;
-

	/* Hex escapes are of the form \xNN -- always two hex digits */

	f++;			/* eat the x */

	if (isxdigit(f[0]) && isxdigit(f[1])) {
+
		int	val;
+

		switch(*f) {
		case '0':
			val = 0x0;
@@ -2391,6 +2391,13 @@ maybe_read_hex_byte(struct sbuf *sbuf, const char *f)
		case 'F':
			val = 0xf0;
			break;
+
		default:
+
			/* This case is to shut up the over-picky
+
			 * compiler warnings about use of an
+
			 * uninitialised value. It can't actually
+
			 * be reached.  */
+
			val = 0x0;
+
			break;
		}

		f++;