Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

- Fixed useless 'array != NULL' check. #28

Merged
merged 1 commit into from

2 participants

@edward-san
  • 'notranslate != NULL' is completely useless, because 'notranslate' is an array, hence removed.
  • I interpreted 'SbarInfoScript != NULL' as a typo, since 1)in the next expression inside the condition there's a dereference to 'SBarInfoScript[SCRIPT_CUSTOM]' and 2)'SBarInfoScript[SCRIPT_CUSTOM]' is checked against 'NULL', in line 352, and then dereferenced when introducing 'cstype'.
@edward-san edward-san - Fixed useless 'array != NULL' check.
- 'notranslate != NULL' is completely useless, because 'notranslate' is an array, hence removed.
- I interpreted 'SbarInfoScript != NULL' as a typo, since 1)in the next expression inside the condition there's a dereference to 'SBarInfoScript[SCRIPT_CUSTOM]' and 2)'SBarInfoScript[SCRIPT_CUSTOM]' is checked against 'NULL', in line 352, and then dereferenced when introducing 'cstype'.
1fb757f
@coelckers coelckers merged commit 1fb757f into rheit:master
@edward-san edward-san deleted the edward-san:array_null_comparison_fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2014
  1. @edward-san

    - Fixed useless 'array != NULL' check.

    edward-san authored
    - 'notranslate != NULL' is completely useless, because 'notranslate' is an array, hence removed.
    - I interpreted 'SbarInfoScript != NULL' as a typo, since 1)in the next expression inside the condition there's a dereference to 'SBarInfoScript[SCRIPT_CUSTOM]' and 2)'SBarInfoScript[SCRIPT_CUSTOM]' is checked against 'NULL', in line 352, and then dereferenced when introducing 'cstype'.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 15 deletions.
  1. +1 −1  src/g_level.cpp
  2. +8 −14 src/v_font.cpp
View
2  src/g_level.cpp
@@ -387,7 +387,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
StatusBar->NewGame ();
setsizeneeded = true;
- if (gameinfo.gametype == GAME_Strife || (SBarInfoScript != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife))
+ if (gameinfo.gametype == GAME_Strife || (SBarInfoScript[SCRIPT_CUSTOM] != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife))
{
// Set the initial quest log text for Strife.
for (i = 0; i < MAXPLAYERS; ++i)
View
22 src/v_font.cpp
@@ -2009,26 +2009,20 @@ void FSpecialFont::LoadTranslations()
}
// exclude the non-translated colors from the translation calculation
- if (notranslate != NULL)
- {
- for (i = 0; i < 256; i++)
- if (notranslate[i])
- usedcolors[i] = false;
- }
+ for (i = 0; i < 256; i++)
+ if (notranslate[i])
+ usedcolors[i] = false;
TotalColors = ActiveColors = SimpleTranslation (usedcolors, PatchRemap, identity, &luminosity);
// Map all untranslated colors into the table of used colors
- if (notranslate != NULL)
+ for (i = 0; i < 256; i++)
{
- for (i = 0; i < 256; i++)
+ if (notranslate[i])
{
- if (notranslate[i])
- {
- PatchRemap[i] = TotalColors;
- identity[TotalColors] = i;
- TotalColors++;
- }
+ PatchRemap[i] = TotalColors;
+ identity[TotalColors] = i;
+ TotalColors++;
}
}
Something went wrong with that request. Please try again.