Re: [PATCH 2/2] grep: don't call regexec() for fixed strings

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Tuesday, January 13, 2009 - 1:13 am

René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:


Mental note.  NUL is marked as GIT_SPECIAL.


Perhaps isspecial() is misnamed if we were to enhance git-ctype in this
way.  It is about a byte being shell glob pattern or a NUL (!!!), and it
should be renamed to isglobspecial() or something.

dir.c uses isspecial() in two places, and both callers rely on NUL being a
part of special to terminate the loops they are in, like this:

	for (;;) {
		unsigned char c = *match++;
		len++;
		if (isspecial(c))
			return len;
	}

It may be a cunning and cute logic, but I do not particularly like it.  It
might be cleaner to rename it to isglobspecial(), drop NUL from it, and
have these two call existing call sites to explicitly check for (c == NUL)
for loop termination.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 2/2] grep: don't call regexec() for fixed strings, Junio C Hamano, (Tue Jan 13, 1:13 am)
[PATCH 1/4] Add ctype test, René, (Sat Jan 17, 8:50 am)
[PATCH 2/4] Reformat ctype.c, René, (Sat Jan 17, 8:50 am)
[PATCH 4/4] Add is_regex_special(), René, (Sat Jan 17, 8:50 am)