diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-06-30 09:16:35 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-06-30 09:16:35 +0000 |
commit | ac7609f7998add41673e8428cf0bc824a40a1361 (patch) | |
tree | 016a7dba118f66dc209b26f930cf9dc4354d7d3b /misc/insremque.c | |
parent | 2774ea772499f5779e846646824784a44377c69a (diff) |
Updated to fedora-glibc-20060630T0858cvs/fedora-glibc-2_4_90-12
Diffstat (limited to 'misc/insremque.c')
-rw-r--r-- | misc/insremque.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/misc/insremque.c b/misc/insremque.c index e366ac8063..7f086cd392 100644 --- a/misc/insremque.c +++ b/misc/insremque.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,12 +24,20 @@ void insque (void *elem, void *prev) { - struct qelem *next = ((struct qelem *) prev)->q_forw; - ((struct qelem *) prev)->q_forw = (struct qelem *) elem; - if (next != NULL) - next->q_back = (struct qelem *) elem; - ((struct qelem *) elem)->q_forw = next; - ((struct qelem *) elem)->q_back = (struct qelem *) prev; + if (prev == NULL) + { + ((struct qelem *) elem)->q_forw = NULL; + ((struct qelem *) elem)->q_back = NULL; + } + else + { + struct qelem *next = ((struct qelem *) prev)->q_forw; + ((struct qelem *) prev)->q_forw = (struct qelem *) elem; + if (next != NULL) + next->q_back = (struct qelem *) elem; + ((struct qelem *) elem)->q_forw = next; + ((struct qelem *) elem)->q_back = (struct qelem *) prev; + } } /* Unlink ELEM from the doubly-linked list that it is in. */ |