summaryrefslogtreecommitdiff
path: root/util.h
blob: 101a802576989713edb3a5a4fab9df007da466a9 (plain)
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
#ifndef UTIL_H
#define UTIL_H

#include "jv.h"

#ifndef HAVE_MKSTEMP
int mkstemp(char *template);
#endif

jv expand_path(jv);
jv get_home(void);
jv jq_realpath(jv);

const void *_jq_memmem(const void *haystack, size_t haystacklen,
                       const void *needle, size_t needlelen);

#ifndef MIN
#define MIN(a,b) \
  ({ __typeof__ (a) _a = (a); \
   __typeof__ (b) _b = (b); \
   _a < _b ? _a : _b; })
#endif
#ifndef MAX
#define MAX(a,b) \
  ({ __typeof__ (a) _a = (a); \
   __typeof__ (b) _b = (b); \
   _a > _b ? _a : _b; })
#endif

#endif /* UTIL_H */