summaryrefslogtreecommitdiff
path: root/util.h
blob: 460ed9ee89ada03ade1bfa03e05c288aa32a1163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef UTIL_H
#define UTIL_H

/*
 * Reads the file denoted by path into a newly allocated output buffer. Returns
 * 0 for success, -1 for error. read_size is the size of output buffer (only to
 * be used in case of success).
 */
int
read_file(char *path, char **output, size_t * read_size);

/*
 * Copies the provided string to a newly allocated buffer. Length of the
 * created string is the same as the provided string.
 * Returns the new string or NULL in case of failure.
 */
char   *
v_strcpy(char *str, size_t len);

#endif				/* UTIL_H */