[libcxxabi] r229074 - Don't use bzero() and strcpy().
Ed Schouten
ed at 80386.nl
Thu Feb 12 23:18:23 PST 2015
Author: ed
Date: Fri Feb 13 01:18:22 2015
New Revision: 229074
URL: http://llvm.org/viewvc/llvm-project?rev=229074&view=rev
Log:
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
Modified:
libcxxabi/trunk/src/Unwind/DwarfParser.hpp
libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp
libcxxabi/trunk/src/Unwind/UnwindLevel1.c
Modified: libcxxabi/trunk/src/Unwind/DwarfParser.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/DwarfParser.hpp?rev=229074&r1=229073&r2=229074&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/DwarfParser.hpp (original)
+++ libcxxabi/trunk/src/Unwind/DwarfParser.hpp Fri Feb 13 01:18:22 2015
@@ -347,7 +347,7 @@ bool CFI_Parser<A>::parseFDEInstructions
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
Modified: libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp?rev=229074&r1=229073&r2=229074&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp (original)
+++ libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp Fri Feb 13 01:18:22 2015
@@ -470,11 +470,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
// 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
// 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",
Modified: libcxxabi/trunk/src/Unwind/UnwindLevel1.c
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindLevel1.c?rev=229074&r1=229073&r2=229074&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindLevel1.c (original)
+++ libcxxabi/trunk/src/Unwind/UnwindLevel1.c Fri Feb 13 01:18:22 2015
@@ -60,11 +60,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
// 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
// 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",
More information about the cfe-commits
mailing list