Lines Matching refs:buf
148 alloc_buffer_mark_failed (struct alloc_buffer *buf) in alloc_buffer_mark_failed() argument
150 buf->__alloc_buffer_current = __ALLOC_BUFFER_INVALID_POINTER; in alloc_buffer_mark_failed()
151 buf->__alloc_buffer_end = __ALLOC_BUFFER_INVALID_POINTER; in alloc_buffer_mark_failed()
156 alloc_buffer_size (const struct alloc_buffer *buf) in alloc_buffer_size() argument
158 return buf->__alloc_buffer_end - buf->__alloc_buffer_current; in alloc_buffer_size()
163 alloc_buffer_has_failed (const struct alloc_buffer *buf) in alloc_buffer_has_failed() argument
165 return buf->__alloc_buffer_current == __ALLOC_BUFFER_INVALID_POINTER; in alloc_buffer_has_failed()
171 alloc_buffer_add_byte (struct alloc_buffer *buf, unsigned char b) in alloc_buffer_add_byte() argument
173 if (__glibc_likely (buf->__alloc_buffer_current < buf->__alloc_buffer_end)) in alloc_buffer_add_byte()
175 *(unsigned char *) buf->__alloc_buffer_current = b; in alloc_buffer_add_byte()
176 ++buf->__alloc_buffer_current; in alloc_buffer_add_byte()
179 alloc_buffer_mark_failed (buf); in alloc_buffer_add_byte()
188 alloc_buffer_alloc_bytes (struct alloc_buffer *buf, size_t length) in alloc_buffer_alloc_bytes() argument
190 if (length <= alloc_buffer_size (buf)) in alloc_buffer_alloc_bytes()
192 void *result = (void *) buf->__alloc_buffer_current; in alloc_buffer_alloc_bytes()
193 buf->__alloc_buffer_current += length; in alloc_buffer_alloc_bytes()
198 alloc_buffer_mark_failed (buf); in alloc_buffer_alloc_bytes()
246 __alloc_buffer_alloc (struct alloc_buffer *buf, size_t size, size_t align) in __alloc_buffer_alloc() argument
249 return alloc_buffer_alloc_bytes (buf, size); in __alloc_buffer_alloc()
251 size_t current = buf->__alloc_buffer_current; in __alloc_buffer_alloc()
256 && new_current <= buf->__alloc_buffer_end) /* Room in buffer. */ in __alloc_buffer_alloc()
258 buf->__alloc_buffer_current = new_current; in __alloc_buffer_alloc()
263 alloc_buffer_mark_failed (buf); in __alloc_buffer_alloc()
272 #define alloc_buffer_alloc(buf, type) \ argument
274 (buf, __alloc_buffer_assert_size (sizeof (type)), \
280 __alloc_buffer_next (struct alloc_buffer *buf, size_t align) in __alloc_buffer_next() argument
283 return (const void *) buf->__alloc_buffer_current; in __alloc_buffer_next()
285 size_t current = buf->__alloc_buffer_current; in __alloc_buffer_next()
288 && aligned <= buf->__alloc_buffer_end) /* Room in buffer. */ in __alloc_buffer_next()
290 buf->__alloc_buffer_current = aligned; in __alloc_buffer_next()
295 alloc_buffer_mark_failed (buf); in __alloc_buffer_next()
327 #define alloc_buffer_next(buf, type) \ argument
329 (buf, __alloc_buffer_assert_align (__alignof__ (type))))
332 void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
342 #define alloc_buffer_alloc_array(buf, type, count) \ argument
344 (buf, __alloc_buffer_assert_size (sizeof (type)), \
357 alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size) in alloc_buffer_copy_bytes() argument
359 *buf = __libc_alloc_buffer_copy_bytes (*buf, src, size); in alloc_buffer_copy_bytes()
371 alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src) in alloc_buffer_copy_string() argument
373 char *result = (char *) buf->__alloc_buffer_current; in alloc_buffer_copy_string()
374 *buf = __libc_alloc_buffer_copy_string (*buf, src); in alloc_buffer_copy_string()
375 if (alloc_buffer_has_failed (buf)) in alloc_buffer_copy_string()