-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsafe.h
33 lines (31 loc) · 1.18 KB
/
safe.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
/*
* Copyright Neil Brown ©2016-2020 <[email protected]>
* May be distributed under terms of GPLv2 - see file:COPYING
*/
#ifndef __CHECK_SAFE__
#define __CHECK_SAFE__ 1
#ifdef __CHECKER__
#define safe __attribute__((safe))
#define safe_cast (void * safe)
extern void *safe calloc(int, int);
extern void *safe malloc(int);
extern void *safe realloc(void *, int);
extern char *safe strdup(const char *safe);
extern char *safe strndup(const char *safe, int);
extern int strcmp(const char *a safe, const char *b safe);
extern int strncmp(const char *a safe, const char *b safe, int n);
extern char *safe strcpy(char *a safe, const char *b safe);
extern char *safe strncpy(char *a safe, const char *b safe, int n);
extern char *safe strcat(char *a safe, const char *b safe);
extern char *safe strncat(char *a safe, const char *b safe, int n);
extern char *strchr(const char *a safe, char b);
extern char *safe strchrnul(const char *a safe, char b);
extern char *strrchr(const char *a safe, char b);
extern int strlen(const char *a safe);
extern const unsigned short int **safe __ctype_b_loc(void);
extern int *safe __errno_location(void);
#else
#define safe
#define safe_cast
#endif
#endif /* __CHECK_SAFE__ */