Project

General

Profile

Feature #1389 ยป 0056-api_common_utilities.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 05/15/2025 03:16 AM

View differences:

common/scriptcore/api_common_utilities.c
fcl = luascript_get_fcl(L);
LUASCRIPT_CHECK(L, fcl != NULL, "Undefined Freeciv lua state!");
LUASCRIPT_CHECK(L, fcl != nullptr, "Undefined Freeciv lua state!");
luascript_log(fcl, level, "%s", message);
}
......
***************************************************************************/
const char *api_utilities_dir2str(lua_State *L, Direction dir)
{
LUASCRIPT_CHECK_STATE(L, NULL);
LUASCRIPT_CHECK(L, is_valid_dir(dir), "Direction is invalid", NULL);
LUASCRIPT_CHECK_STATE(L, nullptr);
LUASCRIPT_CHECK(L, is_valid_dir(dir), "Direction is invalid",
nullptr);
return direction8_name(dir);
}
......
************************************************************************/
const Direction *api_utilities_str2dir(lua_State *L, const char *dir)
{
LUASCRIPT_CHECK_STATE(L, NULL);
LUASCRIPT_CHECK_ARG_NIL(L, dir, 2, string, NULL);
LUASCRIPT_CHECK_STATE(L, nullptr);
LUASCRIPT_CHECK_ARG_NIL(L, dir, 2, string, nullptr);
return luascript_dir(direction8_by_name(dir, fc_strcasecmp));
}
......
{
Direction new_dir = dir;
LUASCRIPT_CHECK_STATE(L, NULL);
LUASCRIPT_CHECK_STATE(L, nullptr);
do {
new_dir = dir_ccw(new_dir);
......
{
Direction new_dir = dir;
LUASCRIPT_CHECK_STATE(L, NULL);
LUASCRIPT_CHECK_STATE(L, nullptr);
do {
new_dir = dir_cw(new_dir);
......
************************************************************************/
const Direction *api_utilities_opposite_dir(lua_State *L, Direction dir)
{
LUASCRIPT_CHECK_STATE(L, NULL);
LUASCRIPT_CHECK_STATE(L, nullptr);
return luascript_dir(opposite_direction(dir));
}
......
char *deprecated_since)
{
if (are_deprecation_warnings_enabled()) {
/* TODO: Keep track which deprecations we have already warned about, and do not keep spamming
* about them. */
if (deprecated_since != NULL && replacement != NULL) {
log_deprecation_always("Deprecated: lua construct \"%s\", deprecated since \"%s\", used. "
"Use \"%s\" instead", method, deprecated_since, replacement);
} else if (replacement != NULL) {
/* TODO: Keep track which deprecations we have already warned about,
* and do not keep spamming about them. */
if (deprecated_since != nullptr && replacement != nullptr) {
log_deprecation_always("Deprecated: lua construct \"%s\", "
"deprecated since \"%s\", used. "
"Use \"%s\" instead", method,
deprecated_since, replacement);
} else if (replacement != nullptr) {
log_deprecation_always("Deprecated: lua construct \"%s\" used. "
"Use \"%s\" instead", method, replacement);
} else {
    (1-1/1)