diff options
Diffstat (limited to 'src/lib/libc/stdlib/remque.c')
| -rw-r--r-- | src/lib/libc/stdlib/remque.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/remque.c b/src/lib/libc/stdlib/remque.c index ae249ae053..71b74b2dce 100644 --- a/src/lib/libc/stdlib/remque.c +++ b/src/lib/libc/stdlib/remque.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: remque.c,v 1.2 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: remque.c,v 1.3 2014/08/15 04:14:36 guenther Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 1993 John Brezak | 4 | * Copyright (c) 1993 John Brezak |
| @@ -28,6 +28,7 @@ | |||
| 28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #include <stdlib.h> | ||
| 31 | #include <search.h> | 32 | #include <search.h> |
| 32 | 33 | ||
| 33 | struct qelem { | 34 | struct qelem { |
| @@ -38,7 +39,10 @@ struct qelem { | |||
| 38 | void | 39 | void |
| 39 | remque(void *element) | 40 | remque(void *element) |
| 40 | { | 41 | { |
| 41 | struct qelem *e = (struct qelem *) element; | 42 | struct qelem *e = element; |
| 42 | e->q_forw->q_back = e->q_back; | 43 | |
| 43 | e->q_back->q_forw = e->q_forw; | 44 | if (e->q_forw != NULL) |
| 45 | e->q_forw->q_back = e->q_back; | ||
| 46 | if (e->q_back != NULL) | ||
| 47 | e->q_back->q_forw = e->q_forw; | ||
| 44 | } | 48 | } |
