File: util.h

package info (click to toggle)
net-tools 1.60%2Bgit20161116.90da8a0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,596 kB
  • ctags: 1,512
  • sloc: ansic: 14,567; makefile: 392; sh: 105
file content (23 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stddef.h>

void *xmalloc(size_t sz);
void *xrealloc(void *p, size_t sz);
char *xstrdup(const char *src);

#define new(p) ((p) = xmalloc(sizeof(*(p))))


int kernel_version(void);
#define KRELEASE(maj,min,patch) ((maj) * 10000 + (min)*1000 + (patch))

long ticks_per_second(void);

int nstrcmp(const char *, const char *);

char *safe_strncpy(char *dst, const char *src, size_t size);


#define netmin(a,b) ((a)<(b) ? (a) : (b))
#define netmax(a,b) ((a)>(b) ? (a) : (b))

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))