dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function
This wasn't used, and it was just asking for trouble.
This commit is contained in:
parent
ea824c6d20
commit
f833e005e1
2 changed files with 0 additions and 53 deletions
|
@ -287,41 +287,3 @@ SDL_GetDataQueueSize(SDL_DataQueue *queue)
|
|||
return queue ? queue->queued_bytes : 0;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
|
||||
{
|
||||
SDL_DataQueuePacket *packet;
|
||||
|
||||
if (queue == NULL) {
|
||||
SDL_InvalidParamError("queue");
|
||||
return NULL;
|
||||
} else if (len == 0) {
|
||||
SDL_InvalidParamError("len");
|
||||
return NULL;
|
||||
} else if (len > queue->packet_size) {
|
||||
SDL_SetError("len is larger than packet size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
packet = queue->head;
|
||||
if (packet) {
|
||||
const size_t avail = queue->packet_size - packet->datalen;
|
||||
if (len <= avail) { /* we can use the space at end of this packet. */
|
||||
void *retval = packet->data + packet->datalen;
|
||||
packet->datalen += len;
|
||||
queue->queued_bytes += len;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
/* Need a fresh packet. */
|
||||
packet = AllocateDataQueuePacket(queue);
|
||||
if (packet == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
packet->datalen = len;
|
||||
queue->queued_bytes += len;
|
||||
return packet->data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue