Don't use bzero() and strcpy().

Instead of bzero(), we can simply use memset(). The strcpy() calls are
unneeded, as we can simply keep track of a pointer to the constant
strings we are copying.

Reviewed by:	Jonathan Roelofs

llvm-svn: 229074
This commit is contained in:
Ed Schouten 2015-02-13 07:18:22 +00:00
parent 4fb4581716
commit 12dc2c4f3b
3 changed files with 21 additions and 16 deletions

View File

@ -347,7 +347,7 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
const CIE_Info &cieInfo, pint_t upToPC,
PrologInfo *results) {
// clear results
bzero(results, sizeof(PrologInfo));
memset(results, '\0', sizeof(PrologInfo));
PrologInfoStackEntry *rememberStack = NULL;
// parse CIE then FDE instructions

View File

@ -470,11 +470,12 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
// When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor1, functionName, 512, &offset) !=
if ((unw_get_proc_name(&cursor1, functionBuf, 512, &offset) !=
UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip))
strcpy(functionName, ".anonymous.");
functionName = ".anonymous.";
unw_word_t pc;
unw_get_reg(&cursor1, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING(
@ -600,11 +601,12 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
// When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionName, 512, &offset) !=
if ((unw_get_proc_name(&cursor2, functionBuf, 512, &offset) !=
UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip))
strcpy(functionName, ".anonymous.");
functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
"lsda=0x%llX, personality=0x%llX\n",

View File

@ -60,11 +60,12 @@ unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
// When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor1, functionName, 512, &offset) !=
if ((unw_get_proc_name(&cursor1, functionBuf, 512, &offset) !=
UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip))
strcpy(functionName, ".anonymous.");
functionName = ".anonymous.";
unw_word_t pc;
unw_get_reg(&cursor1, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING(
@ -156,11 +157,12 @@ unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
// When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionName, 512, &offset) !=
if ((unw_get_proc_name(&cursor2, functionBuf, 512, &offset) !=
UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip))
strcpy(functionName, ".anonymous.");
functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIx64
", func=%s, sp=0x%" PRIx64 ", lsda=0x%" PRIx64
", personality=0x%" PRIx64 "\n",
@ -246,11 +248,12 @@ unwind_phase2_forced(unw_context_t *uc,
// When tracing, print state information.
if (_LIBUNWIND_TRACING_UNWINDING) {
char functionName[512];
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
if ((unw_get_proc_name(&cursor2, functionName, 512, &offset) !=
if ((unw_get_proc_name(&cursor2, functionBuf, 512, &offset) !=
UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip))
strcpy(functionName, ".anonymous.");
functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",