openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1719566 - /openoffice/trunk/main/sal/osl/unx/profile.c
Date Fri, 11 Dec 2015 21:20:42 GMT
Author: pfg
Date: Fri Dec 11 21:20:41 2015
New Revision: 1719566

URL: http://svn.apache.org/viewvc?rev=1719566&view=rev
Log:
Drop useless malloc casts in C code

In ANSI C these casts are unnecessary and can hide warnings.
If this code is moved to C++ we may need such casts back
but we may then consider re-writing the allocation code
altogether.

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

Modified: openoffice/trunk/main/sal/osl/unx/profile.c
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/unx/profile.c?rev=1719566&r1=1719565&r2=1719566&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/unx/profile.c (original)
+++ openoffice/trunk/main/sal/osl/unx/profile.c Fri Dec 11 21:20:41 2015
@@ -237,7 +237,7 @@ static oslProfile SAL_CALL osl_psz_openP
     }
 
 
-	pProfile = (osl_TProfileImpl*)calloc(1, sizeof(osl_TProfileImpl));
+	pProfile = calloc(1, sizeof(osl_TProfileImpl));
 
     if ( pProfile == 0 )
     {
@@ -691,7 +691,7 @@ sal_Bool SAL_CALL osl_writeProfileString
         return (sal_False);
     }
 
-    Line = (sal_Char*) malloc(strlen(pszEntry)+strlen(pszString)+48);
+    Line = malloc(strlen(pszEntry)+strlen(pszString)+48);
 
 	if (! (pProfile->m_Flags & osl_Profile_SYSTEM))
 	{
@@ -1219,7 +1219,7 @@ static sal_Bool OslProfile_lockFile(cons
 static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption ProfileFlags
)
 {
 	int        Flags;
-	osl_TFile* pFile = (osl_TFile*) calloc(1, sizeof(osl_TFile));
+	osl_TFile* pFile = calloc(1, sizeof(osl_TFile));
     sal_Bool bWriteable = sal_False;
 
     if ( ProfileFlags & ( osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE ) )
@@ -1461,7 +1461,7 @@ static sal_Bool OslProfile_putLine(osl_T
 
     if ( pFile->m_pWriteBuf == 0 )
     {
-        pFile->m_pWriteBuf = (sal_Char*) malloc(Len+3);
+        pFile->m_pWriteBuf = malloc(Len+3);
         pFile->m_nWriteBufLen = Len+3;
 		pFile->m_nWriteBufFree = Len+3;
     }
@@ -1471,7 +1471,7 @@ static sal_Bool OslProfile_putLine(osl_T
         {
             sal_Char* pTmp;
 
-            pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen +
Len ) * 2) );
+            pTmp= realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2)
);
             if ( pTmp == 0 )
             {
                 return sal_False;
@@ -1534,7 +1534,7 @@ static sal_Char* addLine(osl_TProfileImp
 			unsigned int oldmax=pProfile->m_MaxLines;
 
             pProfile->m_MaxLines += LINES_ADD;
-            pProfile->m_Lines = (sal_Char **)realloc(pProfile->m_Lines,
+            pProfile->m_Lines = realloc(pProfile->m_Lines,
 				                                 pProfile->m_MaxLines * sizeof(sal_Char *));
 			for ( idx = oldmax ; idx < pProfile->m_MaxLines ; ++idx )
 			{
@@ -1572,7 +1572,7 @@ static sal_Char* insertLine(osl_TProfile
         else
         {
             pProfile->m_MaxLines += LINES_ADD;
-            pProfile->m_Lines = (sal_Char **)realloc(pProfile->m_Lines,
+            pProfile->m_Lines = realloc(pProfile->m_Lines,
 				                                 pProfile->m_MaxLines * sizeof(sal_Char *));
 
             memset(&pProfile->m_Lines[pProfile->m_NoLines],
@@ -1684,13 +1684,13 @@ static sal_Bool addEntry(osl_TProfileImp
             if (pSection->m_Entries == NULL)
             {
                 pSection->m_MaxEntries = ENTRIES_INI;
-                pSection->m_Entries = (osl_TProfileEntry *)malloc(
+                pSection->m_Entries = malloc(
                                 pSection->m_MaxEntries * sizeof(osl_TProfileEntry));
             }
             else
             {
                 pSection->m_MaxEntries += ENTRIES_ADD;
-                pSection->m_Entries = (osl_TProfileEntry *)realloc(pSection->m_Entries,
+                pSection->m_Entries = realloc(pSection->m_Entries,
                                 pSection->m_MaxEntries * sizeof(osl_TProfileEntry));
             }
 
@@ -1749,7 +1749,7 @@ static sal_Bool addSection(osl_TProfileI
 			unsigned int oldmax=pProfile->m_MaxSections;
 
             pProfile->m_MaxSections += SECTIONS_ADD;
-            pProfile->m_Sections = (osl_TProfileSection *)realloc(pProfile->m_Sections,
+            pProfile->m_Sections = realloc(pProfile->m_Sections,
                                           pProfile->m_MaxSections * sizeof(osl_TProfileSection));
 			for ( idx = oldmax ; idx < pProfile->m_MaxSections ; ++idx )
 			{



Mime
View raw message