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
10 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(_WIN32)
11 #define _hidden __attribute__((visibility("hidden")))
16 /* Print formated string into automtically reallocated @uffer.
17 * @buffer automatically reallocated buffer. Must be &NULL or preallocated
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
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
);