aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
blob: 64b39e3a4d74eba640d36dde49b2d0c85814b42c (plain) (blame)
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
/* util.h
 *
 * Copyright (c) 2014 Tharre
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

#ifndef __RUTIL_H__
#define __RUTIL_H__

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

extern void __attribute__((noreturn)) die_(const char *err, ...);
extern void *xmalloc(size_t size);
extern void *xrealloc(void *ptr, size_t size);
extern char *xstrdup(const char *str);
extern char *concat(size_t count, ...);
extern unsigned char *hash_file(FILE *fp);
extern void sha1_to_hex(const unsigned char *sha1, char *buf);
extern void hex_to_sha1(const char *s, unsigned char *sha1);
extern uint32_t generate_seed();

#endif