summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-03 11:35:21 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-09 20:39:53 +0000
commit1736034c39682927830c0660a0b9587f19e53e4e (patch)
tree4fc5712597116f7e95a3d7ef00c444646698d34b /src
parent358e6295fdc494f4f1ed6ab7b1618a82bcd4b0ac (diff)
TMstate.c: Handle -Wduplicated-branches warnings
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 <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/TMstate.c24
1 files 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));