bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [GNU diff] new (?) conditional diff functionality


From: Frédéric Conrotte
Subject: RE: [GNU diff] new (?) conditional diff functionality
Date: Thu, 30 Oct 2003 08:04:48 +0100

I had a look on sources.
I think the modifications should concern this part of code :

in util.c -> analyze_hunk

analyze_hunk (struct change *hunk,
              lin *first0, lin *last0,
              lin *first1, lin *last1)
{
  struct change *next;
  lin l0, l1;
  lin show_from, show_to;
  lin i;
  bool trivial = ignore_blank_lines || ignore_regexp.fastmap;
  size_t trivial_length = (int) ignore_blank_lines - 1;
    /* If 0, ignore zero-length lines;
       if SIZE_MAX, do not ignore lines just because of their length.  */

  char const * const *linbuf0 = files[0].linbuf;  /* Help the compiler.  */
  char const * const *linbuf1 = files[1].linbuf;

  show_from = show_to = 0;

  *first0 = hunk->line0;
  *first1 = hunk->line1;

  next = hunk;
  do
    {
      l0 = next->line0 + next->deleted - 1;
      l1 = next->line1 + next->inserted - 1;
      show_from += next->deleted;
      show_to += next->inserted;

      for (i = next->line0; i <= l0 && trivial; i++)
        {
          char const *line = linbuf0[i];
          size_t len = linbuf0[i + 1] - line - 1;
          if (len != trivial_length
              && (! ignore_regexp.fastmap
                  || re_search (&ignore_regexp, line, len, 0, len, 0) < 0))
            trivial = 0;
        }

      for (i = next->line1; i <= l1 && trivial; i++)
        {
          char const *line = linbuf1[i];
          size_t len = linbuf1[i + 1] - line - 1;
          if (len != trivial_length
              && (! ignore_regexp.fastmap
                  || re_search (&ignore_regexp, line, len, 0, len, 0) < 0))
            trivial = 0;
        }
    }

I guess ignore_regexp.fastmap is the field containing the regular expression and
that I have to "reverse" for the new option

what do you think ?

-----Original Message-----
From: Paul Eggert [mailto:address@hidden
Sent: Wednesday, October 29, 2003 6:06 PM
To: Frédéric Conrotte
Cc: address@hidden
Subject: Re: [GNU diff] new (?) conditional diff functionality


Frédéric Conrotte <address@hidden> writes:

> I'd like to amend diff.c to make this option available

That'd be nice.

> Is there any docs available regarding the diff source code ?

Sorry, no; everything is published.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]