Changeset 1735 for zzuf


Ignore:
Timestamp:
Feb 2, 2007, 12:29:27 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Fixed a minor warning and commented our printf-like function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/debug.c

    r1730 r1735  
    1818
    1919#include "config.h"
    20 
    21 /* Do we want our debug() call to be safe wrt. signals? */
    22 #define SAFE_FUNCTION
    2320
    2421#if defined HAVE_STDINT_H
     
    5350            i /= base; \
    5451        } \
    55         write(fd, b + 1, buf + 127 - b); \
     52        write(fd, b + 1, (int)(buf + 127 - b)); \
    5653    } while(0)
    5754
    5855void _zz_debug(char const *format, ...)
    5956{
    60 #ifdef SAFE_FUNCTION
    6157    static char const *hex2char = "0123456789abcdef";
    6258    char const *f;
    63 #endif
    6459    va_list args;
    6560    int saved_errno;
     
    7065    saved_errno = errno;
    7166    va_start(args, format);
    72 #ifdef SAFE_FUNCTION
     67
     68#if 0
     69    /* This function's code is equivalent to the following *printf calls,
     70     * except it only uses signal-safe functions */
     71    fprintf(stderr, "** zzuf debug ** ");
     72    vfprintf(stderr, format, args);
     73    fprintf(stderr, "\n");
     74#endif
     75
    7376    write(_zz_debugfd, "** zzuf debug ** ", 17);
    7477    for(f = format; *f; f++)
     
    161164    }
    162165    write(_zz_debugfd, "\n", 1);
    163 #else
    164     fprintf(stderr, "** zzuf debug ** ");
    165     vfprintf(stderr, format, args);
    166     fprintf(stderr, "\n");
    167 #endif
    168166    va_end(args);
    169167    errno = saved_errno;
    170168}
    171 
Note: See TracChangeset for help on using the changeset viewer.