[Libreoffice-commits] core.git: sal/osl
Pedro Giffuni
pfg at apache.org
Mon Oct 5 01:17:07 PDT 2015
sal/osl/unx/profile.cxx | 9 +++------
sal/osl/w32/profile.cxx | 9 +++------
2 files changed, 6 insertions(+), 12 deletions(-)
New commits:
commit 06d89e05b2dce1808a3d509c37719042b1c445d8
Author: Pedro Giffuni <pfg at apache.org>
Date: Sun Oct 4 02:07:53 2015 +0000
malloc + memset (0) --> calloc
Drop useless casts while here.
(cherry picked from commit fc4e91e7288d13c40cc78bfa680c7a1e6047c087)
Change-Id: I435c64400d0631926211fbcdc1d38e140462fec1
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 5938087..7ea5afb 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 0f51db3..ca96496 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
{
More information about the Libreoffice-commits
mailing list