Switch/ext/ebtree/ebtree/common/regex.h
static inline int regex_exec2(const struct my_regex *preg, char *subject, int length) {
#if defined(USE_PCRE) || defined(USE_PCRE_JIT)
	if (pcre_exec(preg->reg, preg->extra, subject, length, 0, 0, NULL, 0) < 0)
		return 0;
	return 1;
#else
	int match;
	char old_char = subject[length];
	subject[length] = 0;
	match = regexec(&preg->regex, subject, 0, NULL, 0);
	subject[length] = old_char;
	if (match == REG_NOMATCH)
		return 0;
	return 1;
#endif
}
/* Note that <subject> MUST be at least <length+1> characters long and must
 * be writable because the function will temporarily force a zero past the
 * last character.
 *
 * If the function doesn't match, it returns false, else it returns true.
 */
Note that  MUST be at least  characters long and must
be writable because the function will temporarily force a zero past the
last character.

If the function doesn't match, it returns false, else it returns true.
Note that MUST be at least characters long and must be writable because the function will temporarily force a zero past the last character . If the function doesn ' t match it returns false else it returns true .
static inline int regex_exec2(const struct my_regex *preg, char *subject, int length) {
#if defined(USE_PCRE) || defined(USE_PCRE_JIT)
	if (pcre_exec(preg->reg, preg->extra, subject, length, 0, 0, NULL, 0) < 0)
		return 0;
	return 1;
#else
	int match;
	char old_char = subject[length];
	subject[length] = 0;
	match = regexec(&preg->regex, subject, 0, NULL, 0);
	subject[length] = old_char;
	if (match == REG_NOMATCH)
		return 0;
	return 1;
#endif
}
static inline int regex_exec2 ( const struct my_regex * preg , char * subject , int length ) { #if defined ( USE_PCRE ) || defined ( USE_PCRE_JIT ) if ( pcre_exec ( preg -> reg , preg -> extra , subject , length , 0 , 0 , NULL , 0 ) < 0 ) return 0 ; return 1 ; #else int match ; char old_char = subject [ length ] ; subject [ length ] = 0 ; match = regexec ( & preg -> regex , subject , 0 , NULL , 0 ) ; subject [ length ] = old_char ; if ( match == REG_NOMATCH ) return 0 ; return 1 ; #endif }
Note that <subject> MUST be at least <length+1> characters long and must
 be writable because the function will temporarily force a zero past the
 last character.
Note that <subject > MUST be at least <length + 1 > characters long and must be writable because the function will temporarily force a zero past the last character .