mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-09 21:08:13 +00:00
dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function
This wasn't used, and it was just asking for trouble.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user