Re: [2/4] Sorting commits by date
- From
Petr Baudis <pasky@ucw.cz>
- Date
- Apr 19, 2005, 02:13 UTC
- Message-ID
- <20050419021338.GX5554@pasky.ji.cz>
- In-Reply-To
- <Pine.LNX.4.21.0504182152000.30848-100000@iabervon.org>
Dear diary, on Tue, Apr 19, 2005 at 03:54:56AM CEST, I got a letter where Daniel Barkalow <barkalow@iabervon.org> told me that...
Show 24 quoted lines
> Index: commit.c
> ===================================================================
> --- b3cf8daf9b619ae9f06a28f42a4ae01b69729206/commit.c (mode:100644 sha1:0099baa63971d86ee30ef2a7da25057f0f45a964)
> +++ 7e5a0d93117ecadfb15de3a6bebdb1aa94234fde/commit.c (mode:100644 sha1:ef9af397471817837e1799d72f6707e0ccc949b9)
> @@ -83,3 +83,47 @@
> free(temp);
> }
> }
> +
> +static void insert_by_date(struct commit_list **list, struct commit *item)
> +{
> + struct commit_list **pp = list;
> + struct commit_list *p;
> + while ((p = *pp) != NULL) {
> + if (p->item->date < item->date) {
> + break;
> + }
> + pp = &p->next;
> + }
> + struct commit_list *insert = malloc(sizeof(struct commit_list));
> + insert->next = *pp;
> + *pp = insert;
> + insert->item = item;
> +}Note that you are breaking gcc-2.95 compatibility when using declarator in the middle of a block. Not that it might be a necessarily bad thing ;-) (although I still use gcc-2.95 a lot), just to ring a bell so that it doesn't slip through unnoticed and we can decide on a policy regarding this.
-- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor