OpenTTD Source: src/safeguards.h File Reference

OpenTTD Source 15.3

Macros
safeguards.h File Reference

A number of safeguards to prevent using unsafe methods. More...

Go to the source code of this file.

## Macros
#define | malloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | calloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | realloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strdup SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strndup SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strncpy SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strcat SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strncat SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | sprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | snprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | vsprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | vsnprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strcmp SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strncmp SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strcasecmp SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stricmp SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | memcmp SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | memcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | memmove SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | memset SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | gets SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strtok SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | sscanf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | from_string SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | atoi SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | atol SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | atoll SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strtol SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strtoll SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strtoul SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | strtoull SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoi SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stol SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoll SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoul SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoull SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoimax SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | stoumax SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | printf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | fprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | puts SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | fputs SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | putchar SAFEGUARD_DO_NOT_USE_THIS_METHOD
#define | to_string SAFEGUARD_DO_NOT_USE_THIS_METHOD

## Detailed Description

A number of safeguards to prevent using unsafe methods.

Unsafe methods are, for example, strndup and strncpy because they may leave the string without a null termination, but also strdup and strndup because they can return nullptr and then all strdups would need to be guarded against.

Definition in file safeguards.h.

## Macro Definition Documentation

## ◆ atoi

#define atoi SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 64 of file safeguards.h.

## ◆ atol

#define atol SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 65 of file safeguards.h.

## ◆ atoll

#define atoll SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 66 of file safeguards.h.

## ◆ calloc

#define calloc SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 21 of file safeguards.h.

## ◆ fprintf

#define fprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 81 of file safeguards.h.

## ◆ fputs

#define fputs SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 83 of file safeguards.h.

## ◆ from_string

#define from_string SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 61 of file safeguards.h.

## ◆ gets

#define gets SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 56 of file safeguards.h.

## ◆ malloc

#define malloc SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 20 of file safeguards.h.

## ◆ memcmp

#define memcmp SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 50 of file safeguards.h.

## ◆ memcpy

#define memcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 51 of file safeguards.h.

## ◆ memmove

#define memmove SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 52 of file safeguards.h.

## ◆ memset

#define memset SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 53 of file safeguards.h.

## ◆ printf

#define printf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 80 of file safeguards.h.

## ◆ putchar

#define putchar SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 84 of file safeguards.h.

## ◆ puts

#define puts SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 82 of file safeguards.h.

## ◆ realloc

#define realloc SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 22 of file safeguards.h.

## ◆ snprintf

#define snprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 35 of file safeguards.h.

## ◆ sprintf

#define sprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 34 of file safeguards.h.

## ◆ sscanf

#define sscanf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 60 of file safeguards.h.

## ◆ stoi

#define stoi SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 71 of file safeguards.h.

## ◆ stoimax

#define stoimax SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 76 of file safeguards.h.

## ◆ stol

#define stol SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 72 of file safeguards.h.

## ◆ stoll

#define stoll SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 73 of file safeguards.h.

## ◆ stoul

#define stoul SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 74 of file safeguards.h.

## ◆ stoull

#define stoull SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 75 of file safeguards.h.

## ◆ stoumax

#define stoumax SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 77 of file safeguards.h.

## ◆ strcasecmp

#define strcasecmp SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 44 of file safeguards.h.

## ◆ strcat

#define strcat SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 31 of file safeguards.h.

## ◆ strcmp

#define strcmp SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 39 of file safeguards.h.

## ◆ strcpy

#define strcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 28 of file safeguards.h.

## ◆ strdup

#define strdup SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 25 of file safeguards.h.

## ◆ stricmp

#define stricmp SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 48 of file safeguards.h.

## ◆ strncat

#define strncat SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 32 of file safeguards.h.

## ◆ strncmp

#define strncmp SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 40 of file safeguards.h.

## ◆ strncpy

#define strncpy SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 29 of file safeguards.h.

## ◆ strndup

#define strndup SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 26 of file safeguards.h.

## ◆ strtok

#define strtok SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 59 of file safeguards.h.

## ◆ strtol

#define strtol SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 67 of file safeguards.h.

## ◆ strtoll

#define strtoll SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 68 of file safeguards.h.

## ◆ strtoul

#define strtoul SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 69 of file safeguards.h.

## ◆ strtoull

#define strtoull SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 70 of file safeguards.h.

## ◆ to_string

#define to_string SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 87 of file safeguards.h.

## ◆ vsnprintf

#define vsnprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 37 of file safeguards.h.

## ◆ vsprintf

#define vsprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD

Definition at line 36 of file safeguards.h.