summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Schouten <ed@80386.nl>2015-02-13 07:18:22 +0000
committerEd Schouten <ed@80386.nl>2015-02-13 07:18:22 +0000
commit12dc2c4f3b466c1c461734d1b8fd7e9411c9867b (patch)
tree1df037b2f87b3d3d47d8c1ed627db5e7b6d82059
parent4fb45817161bb3f9366cbdfa878629d1c6237ac9 (diff)
downloadbcm5719-llvm-12dc2c4f3b466c1c461734d1b8fd7e9411c9867b.tar.gz
bcm5719-llvm-12dc2c4f3b466c1c461734d1b8fd7e9411c9867b.zip
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
-rw-r--r--libcxxabi/src/Unwind/DwarfParser.hpp2
-rw-r--r--libcxxabi/src/Unwind/Unwind-EHABI.cpp14
-rw-r--r--libcxxabi/src/Unwind/UnwindLevel1.c21
3 files changed, 21 insertions, 16 deletions
diff --git a/libcxxabi/src/Unwind/DwarfParser.hpp b/libcxxabi/src/Unwind/DwarfParser.hpp
index a9de345f769..f6ef738c471 100644
--- a/libcxxabi/src/Unwind/DwarfParser.hpp
+++ b/libcxxabi/src/Unwind/DwarfParser.hpp
@@ -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
diff --git a/libcxxabi/src/Unwind/Unwind-EHABI.cpp b/libcxxabi/src/Unwind/Unwind-EHABI.cpp
index b296ff1b0a2..2afe86cc2e4 100644
--- a/libcxxabi/src/Unwind/Unwind-EHABI.cpp
+++ b/libcxxabi/src/Unwind/Unwind-EHABI.cpp
@@ -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",
diff --git a/libcxxabi/src/Unwind/UnwindLevel1.c b/libcxxabi/src/Unwind/UnwindLevel1.c
index a4d14fb1491..76dd1043a1d 100644
--- a/libcxxabi/src/Unwind/UnwindLevel1.c
+++ b/libcxxabi/src/Unwind/UnwindLevel1.c
@@ -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",
OpenPOWER on IntegriCloud