Re: [PATCHv2 27/56] string-list: Add API to remove an item from an unsorted list
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Aug 12, 2011, 07:00 UTC
- Message-ID
- <4E44CF9D.8030501@viscovery.net>
- In-Reply-To
- <1313126429-17368-28-git-send-email-newren@gmail.com>
Am 8/12/2011 7:20, schrieb Elijah Newren:
> Here's an attempt for a delete_item API (note: only compile-tested).
Seriously? You haven't even tested this patch, and still don't mark it with RFC?
> Bike-shed painters welcome: delete_item, remove_item, free_item?
You should know that a sentence like this shouldn't appear in the commit message.
Yeah, I know, you just copy-pasted my email text. But that was not a commit message. Perhaps like this:
This implements removal of an entry in O(1) runtime by moving
the last entry to the vacated spot. As such, the routine works
only for unsorted lists.BTW, the code does this:
> + list->items[i] = list->items[list->nr-1];
i.e., it assigns an entire struct. Is this perhaps problematic with older C compilers? (I don't know, I'm more used to C++, where this is well-defined.)
-- Hannes