Bug 29259

Summary: Local variables 'k' and 'y' in s2b() in dtoa.cpp are computed but not used
Product: WebKit Reporter: Wan-Teh Chang <wtc>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Trivial CC: mjs, xan.lopez
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
dtoa.diff none

Wan-Teh Chang
Reported 2009-09-14 15:20:46 PDT
In WebKit/JavaScriptCore/wtf/dtoa.cpp (r48248) on the trunk, we have: static void s2b(BigInt& b, const char* s, int nd0, int nd, uint32_t y9) { int k; int32_t y; int32_t x = (nd + 8) / 9; for (k = 0, y = 1; x > y; y <<= 1, k++) { } ... The local variables 'k' and 'y' are not used after the for loop, so the variables 'k' and 'y' and the for loop can be deleted. This is a cleanup of r43457. Also, the macro Kmax is defined but not used: #define Kmax 15 That definition can be deleted.
Attachments
dtoa.diff (1.92 KB, patch)
2010-08-22 07:53 PDT, Xan Lopez
no flags
Wan-Teh Chang
Comment 1 2009-09-14 15:28:52 PDT
Re: Kmax When dtoa.cpp was moved to WebKit/JavaScriptCore/wtf in r38117, Kmax was already defined but not used. I didn't look further back in the history of dtoa.cpp.
Xan Lopez
Comment 2 2010-08-22 07:53:16 PDT
Created attachment 65060 [details] dtoa.diff Wan-Teh is right... the 'x' variable can also be removed, since it's only used in the loop.
Kent Tamura
Comment 3 2010-08-26 00:32:51 PDT
Comment on attachment 65060 [details] dtoa.diff Looks good.
Xan Lopez
Comment 4 2010-08-26 01:55:14 PDT
Comment on attachment 65060 [details] dtoa.diff Landed as r66089.
Xan Lopez
Comment 5 2010-08-26 01:55:25 PDT
Closing.
Note You need to log in before you can comment on or make changes to this bug.