-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.h
40 lines (31 loc) · 856 Bytes
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
utilities file from sdhash, used for file reading,
under apache license sdhash.org
*/
/*
* General definitions (Vassil Roussev)
*/
#ifndef __UTIL_H
#define __UTIL_H
#include <stdio.h>
#include <stdint.h>
#define KB 1024
#define MB (KB*KB)
#define GB (MB*KB)
#define ALLOC_ONLY 1
#define ALLOC_ZERO 2
#define ALLOC_AUTO 3
#define ERROR_IGNORE 0
#define ERROR_EXIT 1
// Struct describing a mapped file
typedef struct {
char *name;
int fd;
FILE *input;
uint64_t size;
uint8_t *buffer;
} processed_file_t;
processed_file_t *process_file(const char *fname);
void *alloc_check( uint32_t alloc_type, uint64_t mem_bytes, const char *fun_name, const char *var_name, uint32_t error_action);
void *realloc_check( void *buffer, uint64_t new_size);
#endif