1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibC: Deprecate strcpy(), strncpy(), strcat() and strncat() :^)

And also mark strlcpy() and strlcat() with __attribute__((warn_unused_result)).

Since our code is warning-free, this ensures we never misuse those functions.
(Or are very sure about doing it when turning off the warning for a particular
piece of code.)
This commit is contained in:
Sergey Bugaev 2020-08-25 17:48:52 +03:00 committed by Andreas Kling
parent 0106647ab8
commit f808810d00
3 changed files with 25 additions and 3 deletions

View file

@ -95,6 +95,11 @@ static void ensure_caps()
caps->set("li", "25");
}
// Unfortunately, tgetstr() doesn't accept a size argument for the buffer
// pointed to by area, so we have to use bare strcpy().
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
char* tgetstr(const char* id, char** area)
{
ensure_caps();
@ -113,6 +118,8 @@ char* tgetstr(const char* id, char** area)
return nullptr;
}
#pragma GCC diagnostic pop
int tgetflag(const char* id)
{
(void)id;