forked from jedisct1/minisign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.h
49 lines (29 loc) · 991 Bytes
/
helpers.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
41
42
43
44
45
46
47
48
49
#ifndef HELPERS_H
#define HELPERS_H 1
#include <stdint.h>
#include <stdio.h>
#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(X)
#endif
#ifdef _WIN32
#define DIR_SEP '\\'
#else
#define DIR_SEP '/'
#endif
uint64_t le64_load(const unsigned char *p);
void le64_store(unsigned char *p, uint64_t x);
void exit_err(const char *msg) __attribute__((noreturn));
void exit_msg(const char *msg) __attribute__((noreturn));
void *xmalloc(size_t size);
char *xstrdup(const char *str);
void *xsodium_malloc(size_t size);
void xor_buf(unsigned char *dst, const unsigned char *src, size_t len);
int xfput_b64(FILE *fp, const unsigned char *bin, size_t bin_len);
int xfprintf(FILE *fp, const char *format, ...) __attribute__((format(printf, 2, 3)));
int xfclose(FILE *fp);
int trim(char *str);
const char *file_basename(const char *file);
FILE *fopen_create_useronly(const char *file);
int basedir_create_useronly(const char *file);
char *get_home_dir(void);
#endif