source: libcaca/trunk/caca/caca_debug.h @ 4320

Last change on this file since 4320 was 3904, checked in by Sam Hocevar, 10 years ago

Move debugging methods to caca_debug.h.

  • Property svn:keywords set to Id
File size: 1000 bytes
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  $Id: caca_debug.h 3904 2009-11-16 01:15:19Z sam $
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14/*
15 *  This file contains debugging functions.
16 */
17
18#ifndef __CACA_DEBUG_H__
19#define __CACA_DEBUG_H__
20
21/* debug messages */
22#if defined DEBUG && !defined __KERNEL__
23#   include <stdio.h>
24#   include <stdarg.h>
25static inline void debug(const char *format, ...)
26{
27    int saved_errno = geterrno();
28    va_list args;
29    va_start(args, format);
30    fprintf(stderr, "** libcaca debug ** ");
31    vfprintf(stderr, format, args);
32    fprintf(stderr, "\n");
33    va_end(args);
34    seterrno(saved_errno);
35}
36#else
37#   define debug(format, ...) do {} while(0)
38#endif
39
40#endif /* __CACA_DEBUG_H__ */
41
Note: See TracBrowser for help on using the repository browser.