threads / patch / 42335

patchattr: explain the lack of attr-name syntax check in parse_attr()

Subject: [PATCH] attr: explain the lack of attr-name syntax check in parse_attr()

## tl;dr

One message between May 15, 2016 and May 15, 2016. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Junio C Hamano· May 15, 2016, 22:58 UTC · lore
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 attr.c | 6 ++++++
 1 file changed, 6 insertions(+)
Show changes to attr.c +6 −0
diff --git a/attr.c b/attr.c
index 94b27f4..aac5c8f 100644
--- a/attr.c
+++ b/attr.c
@@ -183,6 +183,12 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
 			return NULL;
 		}
 	} else {
+		/*
+		 * As this function is always called twice, once with
+		 * e == NULL in the first pass and then e != NULL in
+		 * the second pass, no need for invalid_attr_name()
+		 * check here.
+		 */
 		if (*cp == '-' || *cp == '!') {
 			e->setto = (*cp == '-') ? ATTR__FALSE : ATTR__UNSET;
 			cp++;
-- 
2.8.2-748-gfb85f76

← back to recent threads