git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] make filepairs detachable

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jun 30, 2006, 07:42 UTC
Message-ID
<81b0412b0606300042r24931d9i5fad0e849b8de84c@mail.gmail.com>
In-Reply-To
<7vy7vfmoit.fsf@assigned-by-dhcp.cox.net>
On 6/30/06, Junio C Hamano <junkio@cox.net> wrote:
Show 8 quoted lines
>
> > 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.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “make filepairs detachable”
  1. 2/4 make filepairs detachableAlex Riesen, Jun 30, 2006
  2. Junio C HamanoJun 30, 2006
  3. Alex RiesenJun 30, 2006
  4. Junio C HamanoJun 30, 2006
  5. Alex RiesenJun 30, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.