-------------------- * SHMQueueNext -- Get the next element from a queue * * To start the iteration, pass the queue head as both queue and curElem. * Returns NULL if no more elements. * * Next element is at curElem->next. If SHMQueue is part of * a larger structure, we want to return a pointer to the * whole structure rather than a pointer to its SHMQueue field. * For example, * struct
| 142 | *-------------------- |
| 143 | */ |
| 144 | Pointer |
| 145 | SHMQueueNext(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset) |
| 146 | { |
| 147 | SHM_QUEUE *elemPtr = curElem->next; |
| 148 | |
| 149 | Assert(ShmemAddrIsValid(curElem)); |
| 150 | |
| 151 | if (elemPtr == queue) /* back to the queue head? */ |
| 152 | return NULL; |
| 153 | |
| 154 | return (Pointer) (((char *) elemPtr) - linkOffset); |
| 155 | } |
| 156 | |
| 157 | /*-------------------- |
| 158 | * SHMQueuePrev -- Get the previous element from a queue |
no test coverage detected