FreeBSD/usr.bin/grep/regex/tre-fastmatch.c
/*
 * Returns: REG_OK on success, error code otherwise
 */
REG_OK on success, error code otherwise
REG_OK on success error code otherwise
int
tre_compile_literal(fastmatch_t *fg, const tre_char_t *pat, size_t n,
		    int cflags)
{
  size_t hasdot = 0, whasdot = 0;
  ssize_t firstdot = -1, wfirstdot = -1;
  INIT_COMP;
  CHECK_MATCHALL(true);
  if (fg->word && (TRE_MB_CUR_MAX > 1))
    return REG_BADPAT;
#ifdef TRE_WCHAR
  SAVE_PATTERN(pat, n, fg->wpattern, fg->wlen);
  STORE_MBS_PAT;
#else
  SAVE_PATTERN(pat, n, fg->pattern, fg->len);
#endif
  DPRINT(("tre_compile_literal: pattern: %s, len %zu, icase: %c, word: %c, "
	 "newline %c\n", fg->pattern, fg->len, fg->icase ? 'y' : 'n',
	 fg->word ? 'y' : 'n', fg->newline ? 'y' : 'n'));
  FILL_QSBC;
  FILL_BMGS;
#ifdef TRE_WCHAR
  FILL_QSBC_WIDE;
  FILL_BMGS_WIDE;
#endif
  return REG_OK;
}
int tre_compile_literal ( fastmatch_t * fg , const tre_char_t * pat , size_t n , int cflags ) { size_t hasdot = 0 , whasdot = 0 ; ssize_t firstdot = -1 , wfirstdot = -1 ; INIT_COMP ; CHECK_MATCHALL ( true ) ; if ( fg -> word && ( TRE_MB_CUR_MAX > 1 ) ) return REG_BADPAT ; #ifdef TRE_WCHAR SAVE_PATTERN ( pat , n , fg -> wpattern , fg -> wlen ) ; STORE_MBS_PAT ; #else SAVE_PATTERN ( pat , n , fg -> pattern , fg -> len ) ; #endif DPRINT ( ( " " " \n " , fg -> pattern , fg -> len , fg -> icase ? ' ' : ' ' , fg -> word ? ' ' : ' ' , fg -> newline ? ' ' : ' ' ) ) ; FILL_QSBC ; FILL_BMGS ; #ifdef TRE_WCHAR FILL_QSBC_WIDE ; FILL_BMGS_WIDE ; #endif return REG_OK ; }
Returns: REG_OK on success, error code otherwise
Returns : REG_OK on success error code otherwise
/* Cannot handle word boundaries with MB string */