Re: [PATCH 2/4] make filepairs detachable

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

 



On 6/30/06, Junio C Hamano <junkio@xxxxxxx> wrote:

> Actually, just make sure diff_flush does not crash for diff queue
> entries which were cleared.

Somehow I really feel uneasy about this one.  I think it is the
responsibility of the one who mangles the queue to adjust the
entries and count consistent.


That's what I get after being exposed to double-linked lists for
too long: I begin to think it's fine to take whatever I want.
The pairs are actually exactly what I need, so I take them.
I think I just have to encapsulate it nicely, i.e.:

   struct diff_filepair *diff_queued_detach(int pos)
   {
       struct diff_filepair *pair = NULL;
       if (pos < diff_queued_diff.nr) {
           diff_queued_diff.queue[pos];
           if (diff_queued_diff.nr - pos > 1)
               memmove(pair->queue + pos, pair->queue + pos + 1,
                       diff_queued_diff.nr - pos - 1);
           diff_queued_diff.nr--;
       }
       return pair;
   }

BTW, is there any chance we get the struct diff_filepair's
double-linked? They don't seem to be sorted. Will increase
the memory footprint, though.
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]