mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Add nodiscard attribute to helper functions where it makes sense
This commit is contained in:
parent
e6acc4e7ed
commit
ae0f955a0e
10 changed files with 71 additions and 29 deletions
|
@ -77,7 +77,7 @@ namespace porting
|
|||
void signal_handler_init();
|
||||
// Returns a pointer to a bool.
|
||||
// When the bool is true, program should quit.
|
||||
bool * signal_handler_killstatus();
|
||||
[[nodiscard]] bool *signal_handler_killstatus();
|
||||
|
||||
/*
|
||||
Path of static data directory.
|
||||
|
@ -105,11 +105,13 @@ extern std::string path_cache;
|
|||
/*
|
||||
Gets the path of our executable.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool getCurrentExecPath(char *buf, size_t len);
|
||||
|
||||
/*
|
||||
Concatenate subpath to path_share.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
std::string getDataPath(const char *subpath);
|
||||
|
||||
/*
|
||||
|
@ -280,7 +282,8 @@ inline const char *getPlatformName()
|
|||
;
|
||||
}
|
||||
|
||||
bool secure_rand_fill_buf(void *buf, size_t len);
|
||||
// Securely fills buffer with bytes from system's random source
|
||||
[[nodiscard]] bool secure_rand_fill_buf(void *buf, size_t len);
|
||||
|
||||
// Call once near beginning of main function.
|
||||
void osSpecificInit();
|
||||
|
@ -308,10 +311,10 @@ static inline void TriggerMemoryTrim() { (void)0; }
|
|||
|
||||
#ifdef _WIN32
|
||||
// Quotes an argument for use in a CreateProcess() commandline (not cmd.exe!!)
|
||||
std::string QuoteArgv(const std::string &arg);
|
||||
[[nodiscard]] std::string QuoteArgv(const std::string &arg);
|
||||
|
||||
// Convert an error code (e.g. from GetLastError()) into a string.
|
||||
std::string ConvertError(DWORD error_code);
|
||||
[[nodiscard]] std::string ConvertError(DWORD error_code);
|
||||
#endif
|
||||
|
||||
// snprintf wrapper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue