summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorPedro Giffuni <pfg@apache.org>2015-10-04 02:07:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-10-05 09:16:06 +0100
commit06d89e05b2dce1808a3d509c37719042b1c445d8 (patch)
treeb13ef5d9c924a24bbeed6b580bcbbdd7253db929 /sal
parentda6f3e1d7fe19b4f661d792a0d8d124bc7bb4241 (diff)
malloc + memset (0) --> calloc
Drop useless casts while here. (cherry picked from commit fc4e91e7288d13c40cc78bfa680c7a1e6047c087) Change-Id: I435c64400d0631926211fbcdc1d38e140462fec1
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/profile.cxx9
-rw-r--r--sal/osl/w32/profile.cxx9
2 files changed, 6 insertions, 12 deletions
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 593808755479..7ea5afb62cc6 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -1206,8 +1206,7 @@ static sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line)
if (pProfile->m_Lines == NULL)
{
pProfile->m_MaxLines = LINES_INI;
- pProfile->m_Lines = static_cast<sal_Char **>(malloc(pProfile->m_MaxLines * sizeof(sal_Char *)));
- memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *));
+ pProfile->m_Lines = static_cast<sal_Char **>(calloc(pProfile->m_MaxLines, sizeof(sal_Char *)));
}
else
{
@@ -1246,8 +1245,7 @@ static sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Line, sa
if (pProfile->m_Lines == NULL)
{
pProfile->m_MaxLines = LINES_INI;
- pProfile->m_Lines = static_cast<sal_Char **>(malloc(pProfile->m_MaxLines * sizeof(sal_Char *)));
- memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *));
+ pProfile->m_Lines = static_cast<sal_Char **>(calloc(pProfile->m_MaxLines, sizeof(sal_Char *)));
}
else
{
@@ -1420,8 +1418,7 @@ static bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* Sec
if (pProfile->m_Sections == NULL)
{
pProfile->m_MaxSections = SECTIONS_INI;
- pProfile->m_Sections = static_cast<osl_TProfileSection *>(malloc(pProfile->m_MaxSections * sizeof(osl_TProfileSection)));
- memset(pProfile->m_Sections,0,pProfile->m_MaxSections * sizeof(osl_TProfileSection));
+ pProfile->m_Sections = static_cast<osl_TProfileSection *>(calloc(pProfile->m_MaxSections, sizeof(osl_TProfileSection)));
}
else
{
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index 0f51db39f032..ca96496e720e 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1385,8 +1385,7 @@ static const sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line)
if (pProfile->m_Lines == NULL)
{
pProfile->m_MaxLines = LINES_INI;
- pProfile->m_Lines = (sal_Char **)malloc(pProfile->m_MaxLines * sizeof(sal_Char *));
- memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *));
+ pProfile->m_Lines = calloc(pProfile->m_MaxLines, sizeof(sal_Char *));
}
else
{
@@ -1427,8 +1426,7 @@ static const sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Li
if (pProfile->m_Lines == NULL)
{
pProfile->m_MaxLines = LINES_INI;
- pProfile->m_Lines = (sal_Char **)malloc(pProfile->m_MaxLines * sizeof(sal_Char *));
- memset(pProfile->m_Lines,0,pProfile->m_MaxLines * sizeof(sal_Char *));
+ pProfile->m_Lines = calloc(pProfile->m_MaxLines, sizeof(sal_Char *));
}
else
{
@@ -1599,8 +1597,7 @@ static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char*
if (pProfile->m_Sections == NULL)
{
pProfile->m_MaxSections = SECTIONS_INI;
- pProfile->m_Sections = (osl_TProfileSection *)malloc(pProfile->m_MaxSections * sizeof(osl_TProfileSection));
- memset(pProfile->m_Sections,0,pProfile->m_MaxSections * sizeof(osl_TProfileSection));
+ pProfile->m_Sections = calloc(pProfile->m_MaxSections, sizeof(osl_TProfileSection));
}
else
{