]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/debugobj.h
Merge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / include / debugobj.h
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 */
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
17 static inline void __attribute__ ((__format__ (__printf__, 2, 3)))
18 ul_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 */