| 82 | } |
| 83 | |
| 84 | int hl_peek(FIFO_RIG *fifo) |
| 85 | { |
| 86 | if (fifo == NULL) { return -1; } |
| 87 | |
| 88 | if (fifo->tail < 0 || fifo->head < 0) { return -1; } |
| 89 | |
| 90 | if (fifo->tail > 1023 || fifo->head > 1023) { return -1; } |
| 91 | |
| 92 | if (fifo->tail == fifo->head) { return -1; } |
| 93 | |
| 94 | pthread_mutex_lock(&fifo->mutex); |
| 95 | char c = fifo->data[fifo->head]; |
| 96 | |
| 97 | #if 0 |
| 98 | |
| 99 | if (isalnum(c)) |
| 100 | rig_debug(RIG_DEBUG_VERBOSE, "%s: peek %c (%d,%d)\n", __func__, c, fifo->head, |
| 101 | fifo->tail); |
| 102 | else |
| 103 | rig_debug(RIG_DEBUG_VERBOSE, "%s: peek 0x%02x (%d,%d)\n", __func__, c, |
| 104 | fifo->head, |
| 105 | fifo->tail); |
| 106 | |
| 107 | #endif |
| 108 | pthread_mutex_unlock(&fifo->mutex); |
| 109 | return c; |
| 110 | } |
| 111 | |
| 112 | int hl_pop(FIFO_RIG *fifo) |
| 113 | { |
no test coverage detected