Ignore:
Timestamp:
Nov 12, 2006, 4:26:13 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Got rid of HAVE_ERRNO_H ifdefs by defining seterrno()/geterrno() functions.
  • More debugging information in the import/export and font functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/common.h

    r1360 r1362  
    1818 */
    1919
     20/* C99 types */
    2021#if defined HAVE_INTTYPES_H && !defined __KERNEL__
    2122#   include <inttypes.h>
     
    3334#endif
    3435
     36/* errno handling */
     37#if defined HAVE_ERRNO_H && !defined __KERNEL__
     38#   include <errno.h>
     39static inline void seterrno(int e) { errno = e; }
     40static inline int geterrno(void) { return errno; }
     41#else
     42#   define seterrno(x) do {} while(0)
     43#   define geterrno(x) 0
     44#endif
     45
     46/* debug messages */
    3547#if defined DEBUG && !defined __KERNEL__
    3648#   include <stdio.h>
    3749#   include <stdarg.h>
    38 #   if defined(HAVE_ERRNO_H)
    39 #       include <errno.h>
    40 #   endif
    4150static inline void debug(const char *format, ...)
    4251{
    43 #   if defined(HAVE_ERRNO_H)
    44     int saved_errno = errno;
    45 #   endif
     52    int saved_errno = geterrno();
    4653    va_list args;
    4754    va_start(args, format);
     
    5057    fprintf(stderr, "\n");
    5158    va_end(args);
    52 #   if defined(HAVE_ERRNO_H)
    53     errno = saved_errno;
    54 #   endif
     59    seterrno(saved_errno);
    5560}
    5661#else
     
    5863#endif
    5964
     65/* hton16() and hton32() */
    6066#if defined HAVE_HTONS
    6167#   if defined __KERNEL__
     
    102108#endif
    103109
    104 #if defined __KERNEL__
    105 #   undef HAVE_ERRNO_H
    106 #endif
    107 
Note: See TracChangeset for help on using the changeset viewer.