sdbf
3.3
|
00001 /* 00002 * General definitions (Vassil Roussev) 00003 */ 00004 #ifndef __UTIL_H 00005 #define __UTIL_H 00006 00007 #include <stdio.h> 00008 #include <stdint.h> 00009 00010 #define KB 1024 00011 #define MB (KB*KB) 00012 #define GB (MB*KB) 00013 00014 #define ALLOC_ONLY 1 00015 #define ALLOC_ZERO 2 00016 #define ALLOC_AUTO 3 00017 00018 #define ERROR_IGNORE 0 00019 #define ERROR_EXIT 1 00020 00021 // Struct describing a mapped file 00022 typedef struct { 00023 char *name; 00024 int fd; 00025 FILE *input; 00026 uint64_t size; 00027 uint8_t *buffer; 00028 } processed_file_t; 00029 00030 processed_file_t *process_file(const char *fname, int64_t min_file_size, uint32_t warnings); 00031 00032 void print256( const uint8_t *buffer); 00033 void *alloc_check( uint32_t alloc_type, uint64_t mem_bytes, const char *fun_name, const char *var_name, uint32_t error_action); 00034 void *realloc_check( void *buffer, uint64_t new_size); 00035 00036 #endif