From 1736034c39682927830c0660a0b9587f19e53e4e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 3 Feb 2023 11:35:21 -0800 Subject: TMstate.c: Handle -Wduplicated-branches warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gets rid of these messages from gcc: TMstate.c: In function ‘GetBranchHead’: TMstate.c:128:12: warning: this condition has identical branches [-Wduplicated-branches] if (parseTree->branchHeadTblSize == 0) ^ TMstate.c: In function ‘_XtGetQuarkIndex’: TMstate.c:183:16: warning: this condition has identical branches [-Wduplicated-branches] if (parseTree->quarkTblSize == 0) ^ Signed-off-by: Alan Coopersmith --- src/TMstate.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/TMstate.c b/src/TMstate.c index e9edbd4..406dfc4 100644 --- a/src/TMstate.c +++ b/src/TMstate.c @@ -103,8 +103,8 @@ GetBranchHead(TMParseStateTree parseTree, TMShortCard modIndex, Boolean isDummy) { -#define TM_BRANCH_HEAD_TBL_ALLOC 8 -#define TM_BRANCH_HEAD_TBL_REALLOC 8 +#define TM_BRANCH_HEAD_TBL_ALLOC ((TMShortCard) 8) +#define TM_BRANCH_HEAD_TBL_REALLOC ((TMShortCard) 8) TMBranchHead branchHead = parseTree->branchHeadTbl; @@ -126,13 +126,9 @@ GetBranchHead(TMParseStateTree parseTree, TMShortCard newSize; if (parseTree->branchHeadTblSize == 0) - parseTree->branchHeadTblSize = - (TMShortCard) (parseTree->branchHeadTblSize + - TM_BRANCH_HEAD_TBL_ALLOC); + parseTree->branchHeadTblSize = TM_BRANCH_HEAD_TBL_ALLOC; else - parseTree->branchHeadTblSize = - (TMShortCard) (parseTree->branchHeadTblSize + - TM_BRANCH_HEAD_TBL_REALLOC); + parseTree->branchHeadTblSize += TM_BRANCH_HEAD_TBL_REALLOC; newSize = (TMShortCard) (parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec)); @@ -168,8 +164,8 @@ GetBranchHead(TMParseStateTree parseTree, TMShortCard _XtGetQuarkIndex(TMParseStateTree parseTree, XrmQuark quark) { -#define TM_QUARK_TBL_ALLOC 16 -#define TM_QUARK_TBL_REALLOC 16 +#define TM_QUARK_TBL_ALLOC ((TMShortCard) 16) +#define TM_QUARK_TBL_REALLOC ((TMShortCard) 16) TMShortCard i; for (i = 0; i < parseTree->numQuarks; i++) @@ -181,13 +177,9 @@ _XtGetQuarkIndex(TMParseStateTree parseTree, XrmQuark quark) TMShortCard newSize; if (parseTree->quarkTblSize == 0) - parseTree->quarkTblSize = - (TMShortCard) (parseTree->quarkTblSize + - TM_QUARK_TBL_ALLOC); + parseTree->quarkTblSize = TM_QUARK_TBL_ALLOC; else - parseTree->quarkTblSize = - (TMShortCard) (parseTree->quarkTblSize + - TM_QUARK_TBL_REALLOC); + parseTree->quarkTblSize += TM_QUARK_TBL_REALLOC; newSize = (TMShortCard) (parseTree->quarkTblSize * sizeof(XrmQuark)); -- cgit v1.2.3