Alien-libmaxminddb

 view release on metacpan or  search on metacpan

maxminddb/src/maxminddb.c  view on Meta::CPAN

// can be raised at build time with -DMAXIMUM_DATA_STRUCTURE_BYTES=<n>.
#ifndef MAXIMUM_DATA_STRUCTURE_BYTES
    #define MAXIMUM_DATA_STRUCTURE_BYTES (1U << 21)
#endif

#if MAXIMUM_DATA_STRUCTURE_BYTES < 1
    #error "MAXIMUM_DATA_STRUCTURE_BYTES must be at least 1"
#endif

#ifdef MMDB_DEBUG
    #define DEBUG_MSG(msg) fprintf(stderr, msg "\n")
    #define DEBUG_MSGF(fmt, ...) fprintf(stderr, fmt "\n", __VA_ARGS__)
    #define DEBUG_BINARY(fmt, byte)                                            \
        do {                                                                   \
            char *binary = byte_to_binary(byte);                               \
            if (NULL == binary) {                                              \
                fprintf(stderr, "Calloc failed in DEBUG_BINARY\n");            \
                abort();                                                       \
            }                                                                  \
            fprintf(stderr, fmt "\n", binary);                                 \
            free(binary);                                                      \
        } while (0)
    #define DEBUG_NL fprintf(stderr, "\n")
#else
    #define DEBUG_MSG(...)
    #define DEBUG_MSGF(...)
    #define DEBUG_BINARY(...)
    #define DEBUG_NL
#endif

#ifdef MMDB_DEBUG
char *byte_to_binary(uint8_t byte) {
    char *bits = calloc(9, sizeof(char));



( run in 4.265 seconds using v1.01-cache-2.11-cpan-60884a8df76 )