Ignore:
Timestamp:
Nov 12, 2006, 2:11:01 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Add a debug() function and a --enable-debug configure flag.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/common.h

    r1304 r1360  
    3131typedef long int intptr_t;
    3232typedef unsigned long int uintptr_t;
     33#endif
     34
     35#if defined DEBUG && !defined __KERNEL__
     36#   include <stdio.h>
     37#   include <stdarg.h>
     38#   if defined(HAVE_ERRNO_H)
     39#       include <errno.h>
     40#   endif
     41static inline void debug(const char *format, ...)
     42{
     43#   if defined(HAVE_ERRNO_H)
     44    int saved_errno = errno;
     45#   endif
     46    va_list args;
     47    va_start(args, format);
     48    fprintf(stderr, "** libcaca debug ** ");
     49    vfprintf(stderr, format, args);
     50    fprintf(stderr, "\n");
     51    va_end(args);
     52#   if defined(HAVE_ERRNO_H)
     53    errno = saved_errno;
     54#   endif
     55}
     56#else
     57#   define debug(format, ...) do {} while(0)
    3358#endif
    3459
Note: See TracChangeset for help on using the changeset viewer.