Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Sep 2011 08:04:02 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225784 - head/sbin/hastd
Message-ID:  <201109270804.p8R842W1011881@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Tue Sep 27 08:04:01 2011
New Revision: 225784
URL: http://svn.freebsd.org/changeset/base/225784

Log:
  - Convert some impossible conditions into assertions.
  - Add missing 'if' in comment.
  
  MFC after:	3 days

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==============================================================================
--- head/sbin/hastd/parse.y	Tue Sep 27 07:59:10 2011	(r225783)
+++ head/sbin/hastd/parse.y	Tue Sep 27 08:04:01 2011	(r225784)
@@ -472,8 +472,8 @@ replication_statement:	REPLICATION repli
 			depth0_replication = $2;
 			break;
 		case 1:
-			if (curres != NULL)
-				curres->hr_replication = $2;
+			PJDLOG_ASSERT(curres != NULL);
+			curres->hr_replication = $2;
 			break;
 		default:
 			PJDLOG_ABORT("replication at wrong depth level");
@@ -496,8 +496,8 @@ checksum_statement:	CHECKSUM checksum_ty
 			depth0_checksum = $2;
 			break;
 		case 1:
-			if (curres != NULL)
-				curres->hr_checksum = $2;
+			PJDLOG_ASSERT(curres != NULL);
+			curres->hr_checksum = $2;
 			break;
 		default:
 			PJDLOG_ABORT("checksum at wrong depth level");
@@ -520,8 +520,8 @@ compression_statement:	COMPRESSION compr
 			depth0_compression = $2;
 			break;
 		case 1:
-			if (curres != NULL)
-				curres->hr_compression = $2;
+			PJDLOG_ASSERT(curres != NULL);
+			curres->hr_compression = $2;
 			break;
 		default:
 			PJDLOG_ABORT("compression at wrong depth level");
@@ -548,8 +548,8 @@ timeout_statement:	TIMEOUT NUM
 			depth0_timeout = $2;
 			break;
 		case 1:
-			if (curres != NULL)
-				curres->hr_timeout = $2;
+			PJDLOG_ASSERT(curres != NULL);
+			curres->hr_timeout = $2;
 			break;
 		default:
 			PJDLOG_ABORT("timeout at wrong depth level");
@@ -569,8 +569,7 @@ exec_statement:		EXEC STR
 			}
 			break;
 		case 1:
-			if (curres == NULL)
-				break;
+			PJDLOG_ASSERT(curres != NULL);
 			if (strlcpy(curres->hr_exec, $2,
 			    sizeof(curres->hr_exec)) >=
 			    sizeof(curres->hr_exec)) {
@@ -639,7 +638,7 @@ resource_statement:	RESOURCE resource_st
 			}
 
 			/*
-			 * Let's see there are some resource-level settings
+			 * Let's see if there are some resource-level settings
 			 * that we can use for node-level settings.
 			 */
 			if (curres->hr_provname[0] == '\0' &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109270804.p8R842W1011881>