openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1706649 - in /openoffice/trunk/main/sal/osl: unx/profile.c w32/profile.cxx
Date Sun, 04 Oct 2015 02:07:53 GMT
Author: pfg
Date: Sun Oct  4 02:07:53 2015
New Revision: 1706649

URL: http://svn.apache.org/viewvc?rev=1706649&view=rev
Log:
malloc + memset (0) --> calloc

Drop useless casts while here.

Modified:
    openoffice/trunk/main/sal/osl/unx/profile.c
    openoffice/trunk/main/sal/osl/w32/profile.cxx

Modified: openoffice/trunk/main/sal/osl/unx/profile.c
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/unx/profile.c?rev=1706649&r1=1706648&r2=1706649&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/unx/profile.c (original)
+++ openoffice/trunk/main/sal/osl/unx/profile.c Sun Oct  4 02:07:53 2015
@@ -1526,8 +1526,7 @@ static sal_Char* addLine(osl_TProfileImp
         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
         {
@@ -1568,8 +1567,7 @@ static sal_Char* insertLine(osl_TProfile
         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
         {
@@ -1743,8 +1741,7 @@ static sal_Bool addSection(osl_TProfileI
         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
         {

Modified: openoffice/trunk/main/sal/osl/w32/profile.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/w32/profile.cxx?rev=1706649&r1=1706648&r2=1706649&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/w32/profile.cxx (original)
+++ openoffice/trunk/main/sal/osl/w32/profile.cxx Sun Oct  4 02:07:53 2015
@@ -1584,8 +1584,7 @@ static const sal_Char* addLine(osl_TProf
 		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
 		{
@@ -1626,8 +1625,7 @@ static const sal_Char* insertLine(osl_TP
 		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
 		{
@@ -1801,8 +1799,7 @@ static sal_Bool addSection(osl_TProfileI
 		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
 		{



Mime
View raw message