From dd9d1a3459f7b38e2af99bdbafd322cacc9dacc2 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 5 Dec 2009 14:40:06 -0800 Subject: misc code review updates More updates from the code review by Steve Grubb . The Jim float-comparision bug just gets a comment not a fix, though. Cc: Steve Grubb . Signed-off-by: David Brownell --- src/helper/jim.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/helper') diff --git a/src/helper/jim.c b/src/helper/jim.c index 117ec56f..c04acf09 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -6077,7 +6077,7 @@ int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr) index = INT_MAX; else index = -(index + 1); - } else if (!end && index < 0) + } else if (index < 0) index = -INT_MAX; /* Free the old internal repr and set the new one. */ Jim_FreeIntRep(interp, objPtr); @@ -7063,7 +7063,6 @@ trydouble: "Got floating-point value where integer was expected", -1); error = 1; goto err; - break; case JIM_EXPROP_ADD: dC = dA + dB; break; case JIM_EXPROP_SUB: dC = dA-dB; break; case JIM_EXPROP_MUL: dC = dA*dB; break; @@ -7071,6 +7070,7 @@ trydouble: case JIM_EXPROP_GT: dC = dA > dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; + /* FIXME comparing floats for equality/inequality is bad juju */ case JIM_EXPROP_NUMEQ: dC = dA == dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: @@ -9889,8 +9889,7 @@ static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, Jim_GetWide(interp, objPtr, &wideValueB) != JIM_OK) { Jim_DecrRefCount(interp, varAObjPtr); - if (varBObjPtr) - Jim_DecrRefCount(interp, varBObjPtr); + Jim_DecrRefCount(interp, varBObjPtr); goto noopt; } } -- cgit v1.2.3