Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
fuzz_helpers.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
9 */
10
15#ifndef FUZZ_HELPERS_H
16#define FUZZ_HELPERS_H
17
18#include "debug.h"
19#include "fuzz.h"
20#include "xxhash.h"
21#include "zstd.h"
22#include <stdint.h>
23#include <stdio.h>
24#include <stdlib.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define MIN(a, b) ((a) < (b) ? (a) : (b))
31#define MAX(a, b) ((a) > (b) ? (a) : (b))
32
33#define FUZZ_QUOTE_IMPL(str) #str
34#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
35
39#define FUZZ_ASSERT_MSG(cond, msg) \
40 ((cond) ? (void)0 \
41 : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
42 __LINE__, FUZZ_QUOTE(cond), (msg)), \
43 abort()))
44#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
45#define FUZZ_ZASSERT(code) \
46 FUZZ_ASSERT_MSG(!ZSTD_isError(code), ZSTD_getErrorName(code))
47
48#if defined(__GNUC__)
49#define FUZZ_STATIC static __inline __attribute__((unused))
50#elif defined(__cplusplus) || \
51 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
52#define FUZZ_STATIC static inline
53#elif defined(_MSC_VER)
54#define FUZZ_STATIC static __inline
55#else
56#define FUZZ_STATIC static
57#endif
58
63void* FUZZ_malloc(size_t size);
64
68int FUZZ_memcmp(void const* lhs, void const* rhs, size_t size);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif
int FUZZ_memcmp(void const *lhs, void const *rhs, size_t size)
Definition fuzz_helpers.c:26
void * FUZZ_malloc(size_t size)
Definition fuzz_helpers.c:16
size_t size
Definition platform.h:559