# [PATCH] lock_any_ref_for_update(): clarify switch case statement

2 messages from 2011-05-10 to 2011-05-10. Participants: Michael Schubert, Junio C Hamano.
Thread: https://gitlist.dev/t/27313

## Michael Schubert, 2011-05-10 11:48

Subject: [PATCH] lock_any_ref_for_update(): clarify switch case statement
Message-ID: <4DC925F1.4060307@elegosoft.com>
URL: https://gitlist.dev/e/4DC925F1.4060307%40elegosoft.com

```

Write CHECK_REF_FORMAT_OK instead of '0' to be more verbose.

Signed-off-by: Michael Schubert <mschub@elegosoft.com>
---
 refs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/refs.c b/refs.c
index e3c0511..67d6bbd 100644
--- a/refs.c
+++ b/refs.c
@@ -1092,7 +1092,7 @@ struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *o
 	switch (check_ref_format(ref)) {
 	default:
 		return NULL;
-	case 0:
+	case CHECK_REF_FORMAT_OK:
 	case CHECK_REF_FORMAT_ONELEVEL:
 		return lock_ref_sha1_basic(ref, old_sha1, flags, NULL);
 	}
-- 
1.7.5.1

```

## Junio C Hamano, 2011-05-10 20:07

Subject: Re: [PATCH] lock_any_ref_for_update(): clarify switch case statement
Message-ID: <7vliyeiaju.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vliyeiaju.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4DC925F1.4060307@elegosoft.com>

```
Michael Schubert <mschub@elegosoft.com> writes:

> Write CHECK_REF_FORMAT_OK instead of '0' to be more verbose.

It is not wrong per-se to spell it out to be more descriptive, but I would
think 0 is clear enough that there is no error.

In any case, being verbose is never a goal ;-).

```
