Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Shut up erroneous warnings about use of 'val' while uninitialized.
Matthew Seaman committed 13 years ago
commit 98c4192d4d4c4276164aaf3dd0c6585e59f0b5a0
parent 241e1c5295d166917e110af72512e8306536720c
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++;