| 120 | } |
| 121 | |
| 122 | DAV_DECLARE(void) dav_set_bufsize(apr_pool_t * p, dav_buffer *pbuf, |
| 123 | apr_size_t size) |
| 124 | { |
| 125 | /* NOTE: this does not retain prior contents */ |
| 126 | |
| 127 | /* NOTE: this function is used to init the first pointer, too, since |
| 128 | the PAD will be larger than alloc_len (0) for zeroed structures */ |
| 129 | |
| 130 | /* grow if we don't have enough for the requested size plus padding */ |
| 131 | if (size + DAV_BUFFER_PAD > pbuf->alloc_len) { |
| 132 | /* set the new length; min of MINSIZE */ |
| 133 | pbuf->alloc_len = size + DAV_BUFFER_PAD; |
| 134 | if (pbuf->alloc_len < DAV_BUFFER_MINSIZE) |
| 135 | pbuf->alloc_len = DAV_BUFFER_MINSIZE; |
| 136 | |
| 137 | pbuf->buf = apr_palloc(p, pbuf->alloc_len); |
| 138 | } |
| 139 | pbuf->cur_len = size; |
| 140 | } |
| 141 | |
| 142 | |
| 143 | /* initialize a buffer and copy the specified (null-term'd) string into it */ |
no outgoing calls
no test coverage detected