Alien-nghttp3

 view release on metacpan or  search on metacpan

vendor/nghttp3-1.18.0/lib/nghttp3_debug.c  view on Meta::CPAN

 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#include "nghttp3_debug.h"

#include <stdio.h>

#ifdef DEBUGBUILD

static void nghttp3_default_debug_vfprintf_callback(const char *fmt,
                                                    va_list args) {
  vfprintf(stderr, fmt, args);
}

static nghttp3_debug_vprintf_callback static_debug_vprintf_callback =
  nghttp3_default_debug_vfprintf_callback;

void nghttp3_debug_vprintf(const char *format, ...) {
  if (static_debug_vprintf_callback) {
    va_list args;
    va_start(args, format);
    static_debug_vprintf_callback(format, args);

vendor/nghttp3-1.18.0/lib/nghttp3_ksl.c  view on Meta::CPAN

  ksl->n = 0;

  nghttp3_objalloc_clear(&ksl->blkalloc);
}

#ifndef WIN32
static void ksl_print(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
                      size_t level) {
  size_t i;

  fprintf(stderr, "LV=%zu n=%u\n", level, blk->n);

  if (blk->leaf) {
    for (i = 0; i < blk->n; ++i) {
      fprintf(stderr, " %" PRId64, *(int64_t *)nghttp3_ksl_blk_nth_key(blk, i));
    }

    fprintf(stderr, "\n");

    return;
  }

  for (i = 0; i < blk->n; ++i) {
    ksl_print(ksl, blk->nodes[i].blk, level + 1);
  }
}

void nghttp3_ksl_print(const nghttp3_ksl *ksl) {

vendor/nghttp3-1.18.0/lib/nghttp3_ksl.h  view on Meta::CPAN

/*
 * nghttp3_ksl_blk_nth_key returns the |n|th key under |blk|.
 */
static inline const nghttp3_ksl_key *
nghttp3_ksl_blk_nth_key(const nghttp3_ksl_blk *blk, size_t n) {
  return blk->keys + n * blk->aligned_keylen;
}

#ifndef WIN32
/*
 * nghttp3_ksl_print prints its internal state in stderr.  It assumes
 * that the key is of type int64_t.  This function should be used for
 * the debugging purpose only.
 */
void nghttp3_ksl_print(const nghttp3_ksl *ksl);
#endif /* !defined(WIN32) */

/*
 * nghttp3_ksl_it_init initializes |it|.
 */
void nghttp3_ksl_it_init(nghttp3_ksl_it *it, nghttp3_ksl_blk *blk, size_t i);

vendor/nghttp3-1.18.0/lib/nghttp3_map.c  view on Meta::CPAN

  size_t tablelen;

  if (map->size == 0) {
    return;
  }

  tablelen = (size_t)1 << map->hashbits;

  for (i = 0; i < tablelen; ++i) {
    if (map->psl[i] == 0) {
      fprintf(stderr, "@%zu <EMPTY>\n", i);
      continue;
    }

    idx = map_index(map, map->keys[i]);
    fprintf(stderr, "@%zu key=%" PRIu64 " base=%zu distance=%u\n", i,
            map->keys[i], idx, map->psl[i] - 1);
  }
}
#endif /* !defined(WIN32) */

static void map_set_entry(nghttp3_map *map, size_t idx,
                          nghttp3_map_key_type key, void *data, size_t psl) {
  map->keys[idx] = key;
  map->data[idx] = data;
  map->psl[idx] = (uint8_t)psl;

vendor/nghttp3-1.18.0/lib/nghttp3_mem.c  view on Meta::CPAN


void *nghttp3_mem_realloc(const nghttp3_mem *mem, void *ptr, size_t size) {
  return mem->realloc(ptr, size, mem->user_data);
}
#else  /* defined(MEMDEBUG) */
void *nghttp3_mem_malloc_debug(const nghttp3_mem *mem, size_t size,
                               const char *func, const char *file,
                               size_t line) {
  void *nptr = mem->malloc(size, mem->user_data);

  fprintf(stderr, "malloc %p size=%zu in %s at %s:%zu\n", nptr, size, func,
          file, line);

  return nptr;
}

void nghttp3_mem_free_debug(const nghttp3_mem *mem, void *ptr, const char *func,
                            const char *file, size_t line) {
  fprintf(stderr, "free ptr=%p in %s at %s:%zu\n", ptr, func, file, line);

  mem->free(ptr, mem->user_data);
}

void nghttp3_mem_free2_debug(const nghttp3_free free_func, void *ptr,
                             void *user_data, const char *func,
                             const char *file, size_t line) {
  fprintf(stderr, "free ptr=%p in %s at %s:%zu\n", ptr, func, file, line);

  free_func(ptr, user_data);
}

void *nghttp3_mem_calloc_debug(const nghttp3_mem *mem, size_t nmemb,
                               size_t size, const char *func, const char *file,
                               size_t line) {
  void *nptr = mem->calloc(nmemb, size, mem->user_data);

  fprintf(stderr, "calloc %p nmemb=%zu size=%zu in %s at %s:%zu\n", nptr, nmemb,
          size, func, file, line);

  return nptr;
}

void *nghttp3_mem_realloc_debug(const nghttp3_mem *mem, void *ptr, size_t size,
                                const char *func, const char *file,
                                size_t line) {
  void *nptr = mem->realloc(ptr, size, mem->user_data);

  fprintf(stderr, "realloc %p ptr=%p size=%zu in %s at %s:%zu\n", nptr, ptr,
          size, func, file, line);

  return nptr;
}
#endif /* defined(MEMDEBUG) */

vendor/nghttp3-1.18.0/lib/nghttp3_unreachable.c  view on Meta::CPAN


  rv = snprintf(buf, buflen, NGHTTP3_UNREACHABLE_TEMPLATE, file, line, func);
  if (rv < 0) {
    abort();
  }

#  ifndef WIN32
  while (write(STDERR_FILENO, buf, (size_t)rv) == -1 && errno == EINTR)
    ;
#  else  /* defined(WIN32) */
  _write(_fileno(stderr), buf, (unsigned int)rv);
#  endif /* defined(WIN32) */

  free(buf);
#endif /* defined(NGHTTP3_UNREACHABLE_LOG) */

  abort();
}



( run in 1.877 second using v1.01-cache-2.11-cpan-60884a8df76 )