From bdf6c3d6728f563a143862f1909cb0e6717a8b23 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 20 Mar 2012 13:43:53 -0700 Subject: Trivial cleanup of typos and fixed-length buffers. Change-Id: I4ea3bb51320160c5ebda8b2a8ba3ca81452915b5 --- src/compiler/codegen/CodegenUtil.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/compiler/codegen/CodegenUtil.cc') diff --git a/src/compiler/codegen/CodegenUtil.cc b/src/compiler/codegen/CodegenUtil.cc index c9c9c5ec95..2e2c25422e 100644 --- a/src/compiler/codegen/CodegenUtil.cc +++ b/src/compiler/codegen/CodegenUtil.cc @@ -326,33 +326,29 @@ void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr) } } -#define BSZ 100 void oatDumpPromotionMap(CompilationUnit *cUnit) { int numRegs = cUnit->numDalvikRegisters + cUnit->numCompilerTemps + 1; for (int i = 0; i < numRegs; i++) { PromotionMap vRegMap = cUnit->promotionMap[i]; - char buf[BSZ]; + std::string buf; if (vRegMap.fpLocation == kLocPhysReg) { - snprintf(buf, 100, " : s%d", vRegMap.fpReg & FP_REG_MASK); - } else { - buf[0] = 0; + StringAppendF(&buf, " : s%d", vRegMap.fpReg & FP_REG_MASK); } - char buf2[BSZ]; - char buf3[BSZ]; + + std::string buf3; if (i < cUnit->numDalvikRegisters) { - snprintf(buf3, BSZ, "%02d", i); + StringAppendF(&buf3, "%02d", i); } else if (i == cUnit->methodSReg) { - strncpy(buf3, "Method*", BSZ); + buf3 = "Method*"; } else { - snprintf(buf3, BSZ, "ct%d", i - cUnit->numDalvikRegisters); + StringAppendF(&buf3, "ct%d", i - cUnit->numDalvikRegisters); } - snprintf(buf2, BSZ, "V[%s] -> %s%d%s", buf3, + LOG(INFO) << StringPrintf("V[%s] -> %s%d%s", buf3.c_str(), vRegMap.coreLocation == kLocPhysReg ? "r" : "SP+", vRegMap.coreLocation == kLocPhysReg ? - vRegMap.coreReg : oatSRegOffset(cUnit, i), buf); - LOG(INFO) << buf2; + vRegMap.coreReg : oatSRegOffset(cUnit, i), buf.c_str()); } } -- cgit v1.2.3-59-g8ed1b