Work around a -Wuse-after-free misdetection in GCC 12 in build_send_check_message_req...
[libisds.git] / test / test-tools.h
blob83f15cdaf59a8e395b2df77c05eb0d5183ead89c
1 #ifndef __ISDS_TEST_TOOLS_H
2 #define __ISDS_TEST_TOOLS_H
4 #include <stdarg.h> /* va_list */
5 #include <stddef.h> /* size_t, NULL */
7 /* _hidden macro marks library private symbols. GCC can exclude them from
8 * global
9 * * symbols table */
10 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(_WIN32)
11 #define _hidden __attribute__((visibility("hidden")))
12 #else
13 #define _hidden
14 #endif
16 /* Print formated string into automtically reallocated @uffer.
17 * @buffer automatically reallocated buffer. Must be &NULL or preallocated
18 * memory.
19 * @format format string as for printf(3)
20 * @ap list of variadic arguments, after call will be in udefined state
21 * @Returns number of bytes printed. In case of errror, -1 and NULL @buffer*/
22 int test_vasprintf(char **buffer, const char *format, va_list ap);
25 /* Print formated string into automtically reallocated @uffer.
26 * @buffer automatically reallocated buffer. Must be &NULL or preallocated
27 * memory.
28 * @format format string as for printf(3)
29 * @... variadic arguments
30 * @Returns number of bytes printed. In case of errror, -1 and NULL @buffer*/
31 int test_asprintf(char **buffer, const char *format, ...);
34 /* I/O. Return 0, in case of error -1. */
35 int test_mmap_file(const char *file, int *fd, void **buffer, size_t *length);
36 int test_munmap_file(int fd, void *buffer, size_t length);
38 #endif