diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-01 01:51:18 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-01 01:52:03 -0800 |
commit | 1b59478f4cf442f5201500b0a9c66f4332fce640 (patch) | |
tree | 02787d99a0476a28836390ee9e2ff332445381a1 /lib/malloc/scratch_buffer.h | |
parent | 50f3949119cd5bb2f058b90d14b2940a3a8a7a0e (diff) | |
download | emacs-1b59478f4cf442f5201500b0a9c66f4332fce640.tar.gz emacs-1b59478f4cf442f5201500b0a9c66f4332fce640.tar.bz2 emacs-1b59478f4cf442f5201500b0a9c66f4332fce640.zip |
Update from Gnulib by running admin/merge-gnulib.
Diffstat (limited to 'lib/malloc/scratch_buffer.h')
-rw-r--r-- | lib/malloc/scratch_buffer.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h index 6efca9ba3f4..26e306212d1 100644 --- a/lib/malloc/scratch_buffer.h +++ b/lib/malloc/scratch_buffer.h @@ -132,4 +132,20 @@ scratch_buffer_set_array_size (struct scratch_buffer *buffer, (buffer, nelem, size)); } +/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, + deallocating *BUFFER if it was heap-allocated. SIZE must be at + most *BUFFER's size. Return NULL (setting errno) on memory + exhaustion. */ +void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, + size_t size); +libc_hidden_proto (__libc_scratch_buffer_dupfree) + +/* Alias for __libc_scratch_dupfree. */ +static __always_inline void * +scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) +{ + void *r = __libc_scratch_buffer_dupfree (buffer, size); + return __glibc_likely (r != NULL) ? r : NULL; +} + #endif /* _SCRATCH_BUFFER_H */ |