Thread (1 message) 1 message, 1 author, 2016-06-16

Re: [PATCH 1/7] submodule--helper: add valid-label-name

From: Junio C Hamano <hidden>
Date: 2016-06-16 02:19:18

Stefan Beller [off-list ref] writes:
+static int submodule_valid_label_name(const char *label)
+{
+	if (!label || !strlen(label))
+		return 0;
+
+	if (!isalnum(*label))
+		return 0;
I'd limit this one to isalpha() if I were doing this to make the
restriction similar to identifiers in traditional programming
language.
+	while (*label) {
+		if (!(isalnum(*label) ||
+			*label == '-'))
And throw in '_' to the mix while at it.
+			return 0;
+		label++;
+	}
+
+	return 1;
+}
If the convention is "0 is good", then please signal "bad" with a
negative value, not just "non-zero".
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help