InChI
 
Loading...
Searching...
No Matches
bcf_s.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2024 IUPAC and InChI Trust
4 */
5
6/* djb-rwth: bounds-checking functions / C11 Annex K */
7
8/* djb-rwth: adding guard idiom instead of #pragma once for code portabilty */
9#ifndef BCF_S_H
10#define BCF_S_H
11
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15#include <errno.h>
16#include "inchi_version.h"
17
18#define CURRENT_VER INCHI_SOFTWARE_VERSION
19
20#ifdef __STDC_LIB_EXT1__
21#if (__STDC_LIB_EXT1__ >= 201112L)
22#define USE_BCF_GCC 1 /* djb-rwth: use bounds-checking functions / C11 Annex K */
23#define __STDC_WANT_LIB_EXT1__ 1 /* Want the ext1 functions */
24#endif
25#endif
26
27#ifdef __STDC_SECURE_LIB__
28#define USE_BCF_MS 1 /* djb-rwth: use bounds-checking functions / C11 Annex K */
29#endif
30
31#if (USE_BCF_GCC || USE_BCF_MS)
32/* djb-rwth: change the following parameter to 1 (or other unsigned integer) to use bounds-checking functions */
33#define USE_BCF 0
34#endif
35
36/* djb-rwth: control macros */
37#define RINCHI_TEST 0 /* djb-rwrh: RInChI testing */
38/* #define GHI100_FIX */ /* djb-rwth: enabling any of the three GHI #100 fixes defined by SPRINTF_FLAG macro */
39#define SPRINTF_FLAG 2 /* djb-rwth: 1 - stb_(v)s(n)pritnf, 2 - custom double to 2*int; any other value (different from 1 or 2) - standard sprintf w/ setlocale */
40
41/* djb-rwth: custom functions */
42int max_3(int a, int b, int c);
43int memcpy_custom(char** dst, char* src, unsigned long long len);
44int dbl2int(char* str, int fwidth, int ndecpl, char dbl_flag, double dblinp);
45
46#endif
int max_3(int a, int b, int c)
Definition bcf_s.c:23
int dbl2int(char *str, int fwidth, int ndecpl, char dbl_flag, double dblinp)
Definition bcf_s.c:57
int memcpy_custom(char **dst, char *src, unsigned long long len)
Definition bcf_s.c:33