MCPcopy Create free account
hub / github.com/OpenPrinting/cups / _cupsBufferGet

Function _cupsBufferGet

cups/ipp.c:51–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 */
50
51char * /* O - Buffer */
52_cupsBufferGet(size_t size) /* I - Size required */
53{
54 _cups_buffer_t *buffer; /* Current buffer */
55 _cups_globals_t *cg = _cupsGlobals();
56 /* Global data */
57
58
59 for (buffer = cg->cups_buffers; buffer; buffer = buffer->next)
60 if (!buffer->used && buffer->size >= size)
61 break;
62
63 if (!buffer)
64 {
65 if ((buffer = malloc(sizeof(_cups_buffer_t) + size - 1)) == NULL)
66 return (NULL);
67
68 buffer->next = cg->cups_buffers;
69 buffer->size = size;
70 cg->cups_buffers = buffer;
71 }
72
73 buffer->used = 1;
74
75 return (buffer->d);
76}
77
78
79/*

Callers 6

cupsSideChannelReadFunction · 0.85
cupsSideChannelSNMPGetFunction · 0.85
cupsSideChannelSNMPWalkFunction · 0.85
cupsSideChannelWriteFunction · 0.85
ippWriteIOFunction · 0.85
ipp_read_ioFunction · 0.85

Calls 1

_cupsGlobalsFunction · 0.85

Tested by

no test coverage detected