A library for a decentralised peer-to-peer chat over IPv6 only.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

lc6_helpers.c 986B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "../inc/lc6_helpers.h"
  4. void lc6helpers_printhex(unsigned char *data, int data_len) {
  5. int i;
  6. for(i=0; i<data_len; i++) {
  7. printf("%02x", data[i]);
  8. }
  9. }
  10. void lc6helpers_banner(unsigned char *str) {
  11. printf("\n");
  12. printf("################################################\n");
  13. printf("# %s\n", str);
  14. printf("################################################\n");
  15. printf("\n");
  16. }
  17. #ifdef LC6_DEBUG
  18. void* lc6helpers_malloc(size_t size, char *file, const char *func, int line) {
  19. printf("[%s:%d] %s called malloc(%lu)\n", file, line, func, size);
  20. return malloc(size);
  21. }
  22. void* lc6helpers_realloc(void *ptr, size_t size, char *file, const char *func, int line) {
  23. printf("[%s:%d] %s called realloc(%p, %lu)\n", file, line, func, ptr, size);
  24. return realloc(ptr, size);
  25. }
  26. void lc6helpers_free(void *ptr, char *file, const char *func, int line) {
  27. printf("[%s:%d] %s called free(%p)\n", file, line, func, ptr);
  28. free(ptr);
  29. }
  30. #endif