Re: [PATCH v6 6/6] list-objects-filter: implement filter tree:0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There were many instances in this file where it seemed like BUG would be
better, so I created a new commit before this one to switch them over. The
interdiff is below.

BTW, why are there so many instances of "die" without "_"? I expect all
errors that may be caused by a user to be localized.

I'm going by the output of this: grep -IrE '\Wdie\([^_]' --exclude-dir=t

diff --git a/list-objects-filter.c b/list-objects-filter.c
index 8e3caf5bf..09b2b05d5 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -44,8 +44,7 @@ static enum list_objects_filter_result filter_blobs_none(

 	switch (filter_situation) {
 	default:
-		die("unknown filter_situation");
-		return LOFR_ZERO;
+		BUG("unknown filter_situation: %d", filter_situation);

 	case LOFS_BEGIN_TREE:
 		assert(obj->type == OBJ_TREE);
@@ -99,8 +98,7 @@ static enum list_objects_filter_result filter_trees_none(

 	switch (filter_situation) {
 	default:
-		die("unknown filter_situation");
-		return LOFR_ZERO;
+		BUG("unknown filter_situation: %d", filter_situation);

 	case LOFS_BEGIN_TREE:
 	case LOFS_BLOB:
@@ -151,8 +149,7 @@ static enum list_objects_filter_result filter_blobs_limit(

 	switch (filter_situation) {
 	default:
-		die("unknown filter_situation");
-		return LOFR_ZERO;
+		BUG("unknown filter_situation: %d", filter_situation);

 	case LOFS_BEGIN_TREE:
 		assert(obj->type == OBJ_TREE);
@@ -257,8 +254,7 @@ static enum list_objects_filter_result filter_sparse(

 	switch (filter_situation) {
 	default:
-		die("unknown filter_situation");
-		return LOFR_ZERO;
+		BUG("unknown filter_situation: %d", filter_situation);

 	case LOFS_BEGIN_TREE:
 		assert(obj->type == OBJ_TREE);
@@ -439,7 +435,7 @@ void *list_objects_filter__init(
 	assert((sizeof(s_filters) / sizeof(s_filters[0])) == LOFC__COUNT);

 	if (filter_options->choice >= LOFC__COUNT)
-		die("invalid list-objects filter choice: %d",
+		BUG("invalid list-objects filter choice: %d",
 		    filter_options->choice);

 	init_fn = s_filters[filter_options->choice];



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux