]> git.ipfire.org Git - thirdparty/util-linux.git/blame - include/debugobj.h
Merge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / include / debugobj.h
CommitLineData
faeb1b64
KZ
1/*
2 * SPDX-License-Identifier: LGPL-2.1-or-later
3 *
4 * Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
5 * Copyright (C) 2014 Karel Zak <kzak@redhat.com>
6 *
7 * This file may be distributed under the terms of the
8 * GNU Lesser General Public License.
9 */
6d00cfb2
KZ
10#ifndef UTIL_LINUX_DEBUGOBJ_H
11#define UTIL_LINUX_DEBUGOBJ_H
12
13/*
14 * Include *after* debug.h and after UL_DEBUG_CURRENT_MASK define.
15 */
16
17static inline void __attribute__ ((__format__ (__printf__, 2, 3)))
18ul_debugobj(const void *handler, const char *mesg, ...)
19{
20 va_list ap;
21
22 if (handler && !(UL_DEBUG_CURRENT_MASK & __UL_DEBUG_FL_NOADDR))
23 fprintf(stderr, "[%p]: ", handler);
24
25 va_start(ap, mesg);
26 vfprintf(stderr, mesg, ap);
27 va_end(ap);
28 fputc('\n', stderr);
29}
30
31#endif /* UTIL_LINUX_DEBUGOBJ_H */