From 2d004034b150df696a1fd36dee6aa2024b7cb774 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 21 Jan 2016 19:35:16 +0000 Subject: [PATCH] Inline some things that looked like happy, fun candidates for inlining. git-svn-id: https://svn.eduke32.com/eduke32@5576 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 55c6d4e4d..cd34007f4 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1358,13 +1358,10 @@ static int32_t C_SetScriptSize(int32_t newsize) return 0; } -static int32_t ispecial(const char c) +static inline int32_t ispecial(const char c) { - if (c == ' ' || c == 0x0d || c == '(' || c == ')' || - c == ',' || c == ';' || (c == 0x0a /*&& ++g_lineNumber*/)) - return 1; - - return 0; + return (c == ' ' || c == 0x0d || c == '(' || c == ')' || + c == ',' || c == ';' || (c == 0x0a /*&& ++g_lineNumber*/)); } static inline void C_NextLine(void) @@ -1453,33 +1450,32 @@ static int32_t C_SkipComments(void) #define GetDefID(szGameLabel) hash_find(&h_gamevars,szGameLabel) #define GetADefID(szGameLabel) hash_find(&h_arrays,szGameLabel) -static int32_t isaltok(const char c) +static inline int32_t isaltok(const char c) { - return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' || - c == '*' || c == '-' || c == '_' || c == '.'); + return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' || c == '*' || c == '-' || c == '_' || + c == '.'); } -static int32_t C_IsLabelChar(const char c, int32_t i) +static inline int32_t C_IsLabelChar(const char c, int32_t const i) { - return (isalnum(c) || c=='_' || c=='*' || c=='?' || - (i > 0 && (c=='+' || c=='-' || c=='.'))); + return (isalnum(c) || c == '_' || c == '*' || c == '?' || (i > 0 && (c == '+' || c == '-' || c == '.'))); } -static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz) +static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t const * const table, const char *psz) { // find the label psz in the table pLabel. // returns the ID for the label, or -1 - int32_t l = hash_findcase(tH,psz); + int32_t l = hash_findcase(table, psz); return (l >= 0) ? pLabel[l].lId : -1; } -static inline int32_t C_GetLabelNameOffset(hashtable_t *tH, const char *psz) +static inline int32_t C_GetLabelNameOffset(hashtable_t const * const table, const char *psz) { // find the label psz in the table pLabel. // returns the offset in the array for the label, or -1 - return hash_findcase(tH,psz); + return hash_findcase(table, psz); } static void C_GetNextLabelName(void) @@ -1491,6 +1487,7 @@ static void C_GetNextLabelName(void) // while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') while (C_IsLabelChar(*textptr, i)) label[(g_numLabels<<6)+(i++)] = *(textptr++); + label[(g_numLabels<<6)+i] = 0; if (!(g_numCompilerErrors|g_numCompilerWarnings) && g_scriptDebug > 1)