1 /*-------------------------------------------------------------------------
2  *
3  * safe_lib.h
4  *
5  * This file contains helper functions to expand on the _s functions from
6  * safestringlib.
7  *
8  * Copyright (c) Citus Data, Inc.
9  *
10  *-------------------------------------------------------------------------
11  */
12 
13 #ifndef CITUS_safe_lib_H
14 #define CITUS_safe_lib_H
15 
16 #include "postgres.h"
17 
18 #include "safe_lib.h"
19 
20 extern void ereport_constraint_handler(const char *message, void *pointer, errno_t error);
21 extern int64 SafeStringToInt64(const char *str);
22 extern uint64 SafeStringToUint64(const char *str);
23 extern void SafeQsort(void *ptr, rsize_t count, rsize_t size,
24 					  int (*comp)(const void *, const void *));
25 void * SafeBsearch(const void *key, const void *ptr, rsize_t count, rsize_t size,
26 				   int (*comp)(const void *, const void *));
27 int SafeSnprintf(char *str, rsize_t count, const char *fmt, ...);
28 
29 #define memset_struct_0(variable) memset(&variable, 0, sizeof(variable))
30 
31 #endif
32