-
Notifications
You must be signed in to change notification settings - Fork 7
/
tools.h
23 lines (18 loc) · 761 Bytes
/
tools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef TOOLS_H_
#define TOOLS_H_
#include <stdlib.h>
#include <stdint.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
uint8_t *load_file(const char *filename, size_t *size_out);
uint8_t *load_gzfile(const char *filename, size_t *size_out);
int gcd(int a, int b); /* Greatest Common Divisor */
int find_pdx_file(const char *mdx_file_path, const char *pdx_filename, char *out, int out_len);
void csv_quote(char *str, size_t len);
#ifndef __MINGW32__
// Execute fn for every file or for each file in every folder
// if recurse = 1, recurse subdirectories
// names and num_names can come from argv and argc
void each_file(const char **names, int num_names, void (*fn)(char *), int recurse);
#endif
#endif /* TOOLS_H_ */