]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/memstream-util.h
hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX
[thirdparty/systemd.git] / src / basic / memstream-util.h
CommitLineData
abe72100
YW
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2#pragma once
3
4#include <stdio.h>
5
6#include "macro.h"
7
8typedef struct MemStream {
9 FILE *f;
10 char *buf;
11 size_t sz;
12} MemStream;
13
14void memstream_done(MemStream *m);
15FILE* memstream_init(MemStream *m);
16int memstream_finalize(MemStream *m, char **ret_buf, size_t *ret_size);
17
18/* This finalizes the passed memstream. */
19int memstream_dump_internal(
20 int level,
21 int error,
22 const char *file,
23 int line,
24 const char *func,
25 MemStream *m);
26#define memstream_dump(level, m) \
27 memstream_dump_internal(level, 0, PROJECT_FILE, __LINE__, __func__, m)