Move to kernel style SPDX license identifiers
[lttng-ust.git] / snprintf / local.h
CommitLineData
bf0d695d
PMF
1/* $OpenBSD: local.h,v 1.14 2009/10/22 01:23:16 guenther Exp $ */
2
c0c0989a
MJ
3/*
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Copyright (C) 1990, 1993
bf0d695d
PMF
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
10 * Chris Torek.
bf0d695d
PMF
11 */
12
13/*
14 * Information local to this implementation of stdio,
15 * in particular, macros and private variables.
16 */
17
2786d9d5
FD
18#include <stdio.h>
19#include <wchar.h>
bf0d695d
PMF
20#include "various.h"
21#include "wcio.h"
22#include "fileext.h"
23
002e1fde
MD
24int __sflush(LTTNG_UST_LFILE *);
25LTTNG_UST_LFILE *__sfp(void);
26int __srefill(LTTNG_UST_LFILE *);
bf0d695d
PMF
27int __sread(void *, char *, int);
28int __swrite(void *, const char *, int);
29fpos_t __sseek(void *, fpos_t, int);
30int __sclose(void *);
31void __sinit(void);
32void _cleanup(void);
002e1fde
MD
33void __smakebuf(LTTNG_UST_LFILE *);
34int __swhatbuf(LTTNG_UST_LFILE *, size_t *, int *);
35int _fwalk(int (*)(LTTNG_UST_LFILE *));
36int __swsetup(LTTNG_UST_LFILE *);
bf0d695d 37int __sflags(const char *, int *);
002e1fde 38wint_t __fgetwc_unlock(LTTNG_UST_LFILE *);
bf0d695d
PMF
39
40extern void __atexit_register_cleanup(void (*)(void));
41extern int __sdidinit;
42
43/*
002e1fde 44 * Return true if the given LTTNG_UST_LFILE cannot be written now.
bf0d695d
PMF
45 */
46#define cantwrite(fp) \
47 ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \
48 __swsetup(fp))
49
50/*
51 * Test whether the given stdio file has an active ungetc buffer;
52 * release such a buffer, without restoring ordinary unread data.
53 */
54#define HASUB(fp) (_UB(fp)._base != NULL)
55#define FREEUB(fp) { \
56 if (_UB(fp)._base != (fp)->_ubuf) \
57 free(_UB(fp)._base); \
58 _UB(fp)._base = NULL; \
59}
60
61/*
62 * test for an fgetln() buffer.
63 */
64#define HASLB(fp) ((fp)->_lb._base != NULL)
65#define FREELB(fp) { \
66 free((char *)(fp)->_lb._base); \
67 (fp)->_lb._base = NULL; \
68}
This page took 0.031824 seconds and 4 git commands to generate.