Remove bzero use and replace with memset (patch from Kirk Beitz).

llvm-svn: 124897
This commit is contained in:
Greg Clayton 2011-02-04 21:13:05 +00:00
parent d2e2f56c36
commit 72b77ebc8a
10 changed files with 24 additions and 24 deletions

View File

@ -571,7 +571,7 @@ ConnectionFileDescriptor::SocketConnect (const char *host_and_port, Error *error
SetSocketOption (m_fd, SOL_SOCKET, SO_REUSEADDR, 1);
struct sockaddr_in sa;
::bzero (&sa, sizeof (sa));
::memset (&sa, 0, sizeof (sa));
sa.sin_family = AF_INET;
sa.sin_port = htons (port);

View File

@ -61,7 +61,7 @@ EmulateInstruction::EmulateInstruction
m_write_reg_callback (write_reg_callback),
m_inst_pc (LLDB_INVALID_ADDRESS)
{
::bzero (&m_inst, sizeof (m_inst));
::memset (&m_inst, 0, sizeof (m_inst));
}
uint64_t

View File

@ -356,7 +356,7 @@ Log::GetLogChannelCallbacks (const char *channel, Log::Callbacks &log_callbacks)
log_callbacks = pos->second;
return true;
}
::bzero (&log_callbacks, sizeof(log_callbacks));
::memset (&log_callbacks, 0, sizeof(log_callbacks));
return false;
}

View File

@ -22,7 +22,7 @@ namespace lldb_private {
UUID::UUID()
{
::bzero (m_uuid, sizeof(m_uuid));
::memset (m_uuid, 0, sizeof(m_uuid));
}
UUID::UUID(const UUID& rhs)
@ -35,7 +35,7 @@ UUID::UUID (const void *uuid_bytes, uint32_t num_uuid_bytes)
if (uuid_bytes && num_uuid_bytes >= 16)
::memcpy (m_uuid, uuid_bytes, sizeof (m_uuid));
else
::bzero (m_uuid, sizeof(m_uuid));
::memset (m_uuid, 0, sizeof(m_uuid));
}
const UUID&
@ -53,7 +53,7 @@ UUID::~UUID()
void
UUID::Clear()
{
::bzero (m_uuid, sizeof(m_uuid));
::memset (m_uuid, 0, sizeof(m_uuid));
}
const void *
@ -85,7 +85,7 @@ UUID::SetBytes (const void *uuid_bytes)
if (uuid_bytes)
::memcpy (m_uuid, uuid_bytes, sizeof (m_uuid));
else
::bzero (m_uuid, sizeof(m_uuid));
::memset (m_uuid, 0, sizeof(m_uuid));
}
size_t

View File

@ -137,7 +137,7 @@ Host::LaunchApplication (const FileSpec &app_file_spec)
app_file_spec.GetPath(app_path, sizeof(app_path));
LSApplicationParameters app_params;
::bzero (&app_params, sizeof (app_params));
::memset (&app_params, 0, sizeof (app_params));
app_params.flags = kLSLaunchDefaults |
kLSLaunchDontAddToRecents |
kLSLaunchNewInstance;
@ -176,7 +176,7 @@ AcceptPIDFromInferior (void *arg)
if (file_conn.Connect (connect_url, &error) == eConnectionStatusSuccess)
{
char pid_str[256];
::bzero (pid_str, sizeof(pid_str));
::memset (pid_str, 0, sizeof(pid_str));
ConnectionStatus status;
const size_t pid_str_len = file_conn.Read (pid_str, sizeof(pid_str), status, NULL);
if (pid_str_len > 0)
@ -316,7 +316,7 @@ LaunchInNewTerminalWithCommandFile
}
LSApplicationParameters app_params;
::bzero (&app_params, sizeof (app_params));
::memset (&app_params, 0, sizeof (app_params));
app_params.flags = kLSLaunchDontAddToRecents | kLSLaunchAsync;
app_params.argv = NULL;
app_params.environment = (CFDictionaryRef)cf_env_dict.get();
@ -638,7 +638,7 @@ Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
static FSRef g_app_fsref;
LSApplicationParameters app_params;
::bzero (&app_params, sizeof (app_params));
::memset (&app_params, 0, sizeof (app_params));
app_params.flags = kLSLaunchDefaults |
kLSLaunchDontAddToRecents |
kLSLaunchDontSwitch;
@ -691,7 +691,7 @@ Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
}
ProcessInfoRec which_process;
bzero(&which_process, sizeof(which_process));
::memset(&which_process, 0, sizeof(which_process));
unsigned char ap_name[PATH_MAX];
which_process.processName = ap_name;
error = ::GetProcessInformation (&psn, &which_process);

View File

@ -230,7 +230,7 @@ protected:
slide = 0;
mod_date = 0;
file_spec.Clear();
::bzero (&header, sizeof(header));
::memset (&header, 0, sizeof(header));
}
uuid.Clear();
segments.clear();

View File

@ -107,8 +107,8 @@ ObjectFileMachO::ObjectFileMachO(Module* module, DataBufferSP& dataSP, const Fil
m_sections_ap(),
m_symtab_ap()
{
::bzero (&m_header, sizeof(m_header));
::bzero (&m_dysymtab, sizeof(m_dysymtab));
::memset (&m_header, 0, sizeof(m_header));
::memset (&m_dysymtab, 0, sizeof(m_dysymtab));
}
@ -280,7 +280,7 @@ ObjectFileMachO::ParseSections ()
}
struct section_64 sect64;
::bzero (&sect64, sizeof(sect64));
::memset (&sect64, 0, sizeof(sect64));
// Push a section into our mach sections for the section at
// index zero (NListSectionNoSection) if we don't have any
// mach sections yet...

View File

@ -455,10 +455,10 @@ MachException::Data::PutToLog(Log *log) const
MachException::PortInfo::PortInfo() :
count(0)
{
::bzero (masks, sizeof(masks));
::bzero (ports, sizeof(ports));
::bzero (behaviors, sizeof(behaviors));
::bzero (flavors, sizeof(flavors));
::memset (masks, 0, sizeof(masks));
::memset (ports, 0, sizeof(ports));
::memset (behaviors, 0, sizeof(behaviors));
::memset (flavors, 0, sizeof(flavors));
}

View File

@ -45,9 +45,9 @@ ThreadMacOSX::ThreadMacOSX (ProcessMacOSX &process, lldb::tid_t tid) :
m_context.reset(create_arch_callback(process.GetArchSpec(), *this));
assert(m_context.get() != NULL);
m_context->InitializeInstance();
::bzero (&m_basic_info, sizeof (m_basic_info));
::bzero (&m_ident_info, sizeof (m_ident_info));
::bzero (&m_proc_threadinfo, sizeof (m_proc_threadinfo));
::memset (&m_basic_info, 0, sizeof (m_basic_info));
::memset (&m_ident_info, 0, sizeof (m_ident_info));
::memset (&m_proc_threadinfo, 0, sizeof (m_proc_threadinfo));
ProcessMacOSXLog::LogIf(PD_LOG_THREAD | PD_LOG_VERBOSE, "ThreadMacOSX::ThreadMacOSX ( pid = %i, tid = 0x%4.4x, )", m_process.GetID(), GetID());
}

View File

@ -192,7 +192,7 @@ ThreadPlanAssemblyTracer::Log ()
if (m_disassembler)
{
bzero(m_buffer_sp->GetBytes(), m_buffer_sp->GetByteSize());
::memset(m_buffer_sp->GetBytes(), 0, m_buffer_sp->GetByteSize());
Error err;
m_process.ReadMemory(pc, m_buffer_sp->GetBytes(), m_buffer_sp->GetByteSize(), err);