OpenTTD Source 20241224-master-gf74b0cf984
|
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 | gets SAFEGUARD_DO_NOT_USE_THIS_METHOD |
#define | strtok 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 |
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 that instead of using the current MallocT/ReallocT/CallocT technique of just giving the user an error that too much memory was used instead of spreading that code though the whole code base.
Definition in file safeguards.h.
#define calloc SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 26 of file safeguards.h.
#define fprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 59 of file safeguards.h.
#define fputs SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 61 of file safeguards.h.
#define gets SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 52 of file safeguards.h.
#define malloc SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 23 of file safeguards.h.
#define printf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 58 of file safeguards.h.
#define putchar SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 62 of file safeguards.h.
#define puts SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 60 of file safeguards.h.
#define realloc SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 29 of file safeguards.h.
#define snprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 45 of file safeguards.h.
#define sprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 44 of file safeguards.h.
#define strcat SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 40 of file safeguards.h.
#define strcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 36 of file safeguards.h.
#define strdup SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 32 of file safeguards.h.
#define strncat SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 41 of file safeguards.h.
#define strncpy SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 37 of file safeguards.h.
#define strndup SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 33 of file safeguards.h.
#define strtok SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 55 of file safeguards.h.
#define vsnprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 49 of file safeguards.h.
#define vsprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD |
Definition at line 48 of file safeguards.h.