dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function

This wasn't used, and it was just asking for trouble.

(cherry picked from commit f833e005e1)
This commit is contained in:
Ryan C. Gordon
2023-03-02 16:06:38 -05:00
parent f47a08ab84
commit f5bb286b76
2 changed files with 0 additions and 54 deletions

View File

@@ -288,43 +288,4 @@ SDL_CountDataQueue(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;
}
/* vi: set ts=4 sw=4 expandtab: */