|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include <stdio.h>
- #include <stdlib.h>
-
- #include "../inc/lc6_helpers.h"
-
-
- void lc6helpers_printhex(unsigned char *data, int data_len) {
- int i;
-
- for(i=0; i<data_len; i++) {
- printf("%02x", data[i]);
- }
- }
-
- void lc6helpers_banner(unsigned char *str) {
-
- printf("\n");
- printf("################################################\n");
- printf("# %s\n", str);
- printf("################################################\n");
- printf("\n");
- }
-
- #ifdef LC6_DEBUG
-
- void* lc6helpers_malloc(size_t size, char *file, const char *func, int line) {
- printf("[%s:%d] %s called malloc(%lu)\n", file, line, func, size);
- return malloc(size);
- }
-
- void* lc6helpers_realloc(void *ptr, size_t size, char *file, const char *func, int line) {
- printf("[%s:%d] %s called realloc(%p, %lu)\n", file, line, func, ptr, size);
- return realloc(ptr, size);
- }
-
- void lc6helpers_free(void *ptr, char *file, const char *func, int line) {
- printf("[%s:%d] %s called free(%p)\n", file, line, func, ptr);
- free(ptr);
- }
-
- #endif
|