FreeBSD/contrib/diff/src/context.c
/* Find the last function-header line in LINBUF prior to line number LINENUM.
   This is a line containing a match for the regexp in `function_regexp'.
   Return the address of the text, or 0 if no function-header is found.  */
Find the last function-header line in LINBUF prior to line number LINENUM.
This is a line containing a match for the regexp in `function_regexp'.
Return the address of the text, or 0 if no function-header is found.
Find the last function - header line in LINBUF prior to line number LINENUM . This is a line containing a match for the regexp in ` function_regexp ' . Return the address of the text or 0 if no function - header is found .
static char const *
find_function (char const * const *linbuf, lin linenum)
{
  lin i = linenum;
  lin last = find_function_last_search;
  find_function_last_search = i;
  while (last <= --i)
    {
      char const *line = linbuf[i];
      size_t linelen = linbuf[i + 1] - line - 1;
      int len = MIN (linelen, INT_MAX);
      if (0 <= re_search (&function_regexp, line, len, 0, len, 0))
	{
	  find_function_last_match = i;
	  return line;
	}
    }
  if (find_function_last_match != LIN_MAX)
    return linbuf[find_function_last_match];
  return 0;
}
static char const * find_function ( char const * const * linbuf , lin linenum ) { lin i = linenum ; lin last = find_function_last_search ; find_function_last_search = i ; while ( last <= -- i ) { char const * line = linbuf [ i ] ; size_t linelen = linbuf [ i + 1 ] - line - 1 ; int len = MIN ( linelen , INT_MAX ) ; if ( 0 <= re_search ( & function_regexp , line , len , 0 , len , 0 ) ) { find_function_last_match = i ; return line ; } } if ( find_function_last_match != LIN_MAX ) return linbuf [ find_function_last_match ] ; return 0 ; }
Find the last function-header line in LINBUF prior to line number LINENUM.
Find the last function - header line in LINBUF prior to line number LINENUM .
/* See if this line is what we want.  */ /* FIXME: re_search's size args should be size_t, not int.  */ /* If we search back to where we started searching the previous time,
     find the line we found last time.  */