|
|
| version 1.1.1.1, 2012/02/21 16:42:02 | version 1.1.1.2, 2012/10/09 09:13:23 |
|---|---|
| Line 1 | Line 1 |
| /* | /* |
| * Copyright (C) 2008-2010 Daisuke Aoyama <aoyama@peach.ne.jp>. | * Copyright (C) 2008-2012 Daisuke Aoyama <aoyama@peach.ne.jp>. |
| * All rights reserved. | * All rights reserved. |
| * | * |
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without |
| Line 46 istgt_queue_init(ISTGT_QUEUE_Ptr head) | Line 46 istgt_queue_init(ISTGT_QUEUE_Ptr head) |
| head->prev = NULL; | head->prev = NULL; |
| head->next = NULL; | head->next = NULL; |
| head->elem = NULL; | head->elem = NULL; |
| head->num = 0; | |
| return 0; | return 0; |
| } | } |
| Line 68 istgt_queue_destroy(ISTGT_QUEUE_Ptr head) | Line 69 istgt_queue_destroy(ISTGT_QUEUE_Ptr head) |
| int | int |
| istgt_queue_count(ISTGT_QUEUE_Ptr head) | istgt_queue_count(ISTGT_QUEUE_Ptr head) |
| { | { |
| #if 0 | |
| ISTGT_QUEUE_Ptr qp; | ISTGT_QUEUE_Ptr qp; |
| int num; | int num; |
| Line 78 istgt_queue_count(ISTGT_QUEUE_Ptr head) | Line 80 istgt_queue_count(ISTGT_QUEUE_Ptr head) |
| num++; | num++; |
| } | } |
| return num; | return num; |
| #else | |
| if (head == NULL) | |
| return 0; | |
| return head->num; | |
| #endif | |
| } | } |
| int | int |
| Line 105 istgt_queue_enqueue(ISTGT_QUEUE_Ptr head, void *elem) | Line 112 istgt_queue_enqueue(ISTGT_QUEUE_Ptr head, void *elem) |
| qp->next = head; | qp->next = head; |
| qp->prev = tail; | qp->prev = tail; |
| } | } |
| head->num++; | |
| return 0; | return 0; |
| } | } |
| Line 132 istgt_queue_dequeue(ISTGT_QUEUE_Ptr head) | Line 140 istgt_queue_dequeue(ISTGT_QUEUE_Ptr head) |
| next->prev = head; | next->prev = head; |
| } | } |
| } | } |
| head->num--; | |
| return elem; | return elem; |
| } | } |
| Line 160 istgt_queue_enqueue_first(ISTGT_QUEUE_Ptr head, void * | Line 169 istgt_queue_enqueue_first(ISTGT_QUEUE_Ptr head, void * |
| qp->next = first; | qp->next = first; |
| qp->prev = head; | qp->prev = head; |
| } | } |
| head->num++; | |
| return 0; | return 0; |
| } | } |