[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sal/osl

Pedro Giffuni pfg at apache.org
Fri Dec 11 14:09:09 PST 2015


 sal/osl/unx/profile.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit dd99de576cf795c1c8b3e58e844f3fe00db62f7b
Author: Pedro Giffuni <pfg at apache.org>
Date:   Fri Dec 11 21:20:41 2015 +0000

    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.

diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index cb13b59..0379070 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -237,7 +237,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o
     }
 
 
-    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(oslProfile Profile,
         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(const osl_TFile* pFile, osl_TLockMode eMode)
 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_TFile* pFile, const sal_Char *pszLine)
 
     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_TFile* pFile, const sal_Char *pszLine)
         {
             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_TProfileImpl* pProfile, const sal_Char* Line)
             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_TProfileImpl* pProfile, const sal_Char* Line, sa
         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_TProfileImpl* pProfile, osl_TProfileSection *pSecti
             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_TProfileImpl* pProfile, int Line, const sal_Char*
             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 )
             {


More information about the Libreoffice-commits mailing list