Update vendored msgpack-c to 4.0.0
[lttng-tools.git] / src / vendor / msgpack / fbuffer.h
CommitLineData
116a02e3
JG
1/*
2 * MessagePack for C FILE* buffer adaptor
3 *
4 * Copyright (C) 2013 Vladimir Volodko
5 *
6 * Distributed under the Boost Software License, Version 1.0.
7 * (See accompanying file LICENSE_1_0.txt or copy at
8 * http://www.boost.org/LICENSE_1_0.txt)
9 */
10#ifndef MSGPACK_FBUFFER_H
11#define MSGPACK_FBUFFER_H
12
13#include <stdio.h>
0c07860d 14#include <assert.h>
116a02e3
JG
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20
21/**
22 * @defgroup msgpack_fbuffer FILE* buffer
23 * @ingroup msgpack_buffer
24 * @{
25 */
26
27static inline int msgpack_fbuffer_write(void* data, const char* buf, size_t len)
28{
0c07860d
MJ
29 assert(buf || len == 0);
30 if(!buf) return 0;
31
116a02e3
JG
32 return (1 == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
33}
34
35/** @} */
36
37
38#ifdef __cplusplus
39}
40#endif
41
42#endif /* msgpack/fbuffer.h */
This page took 0.029828 seconds and 4 git commands to generate.