vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Tue, Jan 15, 2008 at 12:14:12AM +0100, Tim van der Molen wrote: > On Mon, 14 Jan 2008 17:49:41 +0100, Otto Moerbeek wrote: > > On Mon, Jan 14, 2008 at 04:14:12PM +0100, Tim van der Molen wrote: > > > > > On Mon, 14 Jan 2008 14:51:58 +0100, Otto Moerbeek wrote: > > > > On Mon, Jan 14, 2008 at 02:12:37PM +0100, Tim van der Molen wrote: > > > > > > > > > Hello, > > > > > > > > > > `diff -p' is searching for the relevant function prototype *outside* the > > > > > context, but if the function prototype happens to be inside the context, > > > > > then it won't be found. This diff makes the search begin at the changed > > > > > line itself. > > > > > > > > Why repeat informatioon that is already shown in the context? I think > > > > it is quite reasnable the way it works now. > > > > > > Well, the point is not to repeat information, but to print correct > > > information. Also, searching inside the context doesn't introduce > > > drawbacks, does it? So why not do it if that can make diff(1) better > > > than `quite reasonable'? > > > > > > Yes, it's a small issue. But then, so is the diff. > > > > > > Anyway, thanks for your reply. > > > > My point is, the if the declaration is in the context, it makes little > > sense to repeat it in the chunk header: > > But it does not make much sense to show the wrong declaration either, > wouldn't you agree? I don't understand why you prefer an incorrect > declaration over a correct, but repeated one. There's no easy definition of "correct" here. diff does not know C. It does exactly what is documented. Furthemore, it does produce the same info as cvs diff and gnu diff, which is a plus in this case. -Otto > > Regards, > Tim > > > Take this example. From the context it is clear that we're changing > > mastercmp(). > > > > -Otto > > > > Index: ls.c > > ================================================== ================= > > RCS file: /cvs/src/bin/ls/ls.c,v > > retrieving revision 1.29 > > diff -u -p -r1.29 ls.c > > --- ls.c 7 May 2007 18:39:28 -0000 1.29 > > +++ ls.c 14 Jan 2008 16:47:59 -0000 > > @@ -567,7 +567,7 @@ display(FTSENT *p, FTSENT *list) > > static int > > mastercmp(const FTSENT **a, const FTSENT **b) > > { > > - int a_info, b_info; > > + int a_info, b_info; boo; > > > > a_info = (*a)->fts_info; > > if (a_info == FTS_ERR) > > > > > > > > > > Regards, > > > Tim > > > > > > > > Index: diff.1 > > > > > ================================================== ================= > > > > > RCS file: /cvs/src/usr.bin/diff/diff.1,v > > > > > retrieving revision 1.33 > > > > > diff -p -u -r1.33 diff.1 > > > > > --- diff.1 31 May 2007 19:20:09 -0000 1.33 > > > > > +++ diff.1 13 Jan 2008 15:13:40 -0000 > > > > > @@ -234,7 +234,7 @@ other differences are remembered and sum > > > > > after all text file differences are reported. > > > > > .It Fl p > > > > > With unified and context diffs, show with each change > > > > > -the first 40 characters of the last line before the context beginning > > > > > +the first 40 characters of the last line before the change beginning > > > > > with a letter, an underscore or a dollar sign. > > > > > For C source code following standard layout conventions, this will > > > > > show the prototype of the function the change applies to. > > > > > Index: diffreg.c > > > > > ================================================== ================= > > > > > RCS file: /cvs/src/usr.bin/diff/diffreg.c,v > > > > > retrieving revision 1.70 > > > > > diff -p -u -r1.70 diffreg.c > > > > > --- diffreg.c 11 Sep 2007 15:47:17 -0000 1.70 > > > > > +++ diffreg.c 13 Jan 2008 15:13:41 -0000 > > > > > @@ -1358,7 +1358,7 @@ dump_context_vec(FILE *f1, FILE *f2) > > > > > > > > > > printf("***************"); > > > > > if (pflag) { > > > > > - f = match_function(ixold, lowa-1, f1); > > > > > + f = match_function(ixold, cvp->a, f1); > > > > > if (f != NULL) { > > > > > putchar(' '); > > > > > fputs(f, stdout); > > > > > @@ -1467,7 +1467,7 @@ dump_unified_vec(FILE *f1, FILE *f2) > > > > > uni_range(lowc, upd); > > > > > fputs(" @@", stdout); > > > > > if (pflag) { > > > > > - f = match_function(ixold, lowa-1, f1); > > > > > + f = match_function(ixold, cvp->a, f1); > > > > > if (f != NULL) { > > > > > putchar(' '); > > > > > fputs(f, stdout); |