desktop/source/pagein/file_image_unx.c | 10 +- desktop/source/pagein/pagein.c | 8 - rsc/source/rscpp/cpp3.c | 2 rsc/source/rscpp/cpp4.c | 2 rsc/source/rscpp/cpp5.c | 2 sal/osl/os2/diagnose.c | 2 sal/osl/os2/module.c | 4 sal/osl/os2/nlsupport.c | 2 sal/osl/os2/process.c | 28 +++--- sal/osl/os2/profile.c | 56 ++++++------- sal/osl/os2/socket.c | 56 ++++++------- sal/osl/os2/tempfile.c | 23 ++--- sal/osl/os2/thread.c | 14 +-- sal/osl/unx/backtrace.c | 8 - sal/osl/unx/conditn.c | 12 +- sal/osl/unx/diagnose.c | 14 +-- sal/osl/unx/module.c | 2 sal/osl/unx/mutex.c | 8 - sal/osl/unx/nlsupport.c | 8 - sal/osl/unx/pipe.c | 8 - sal/osl/unx/process.c | 42 ++++----- sal/osl/unx/profile.c | 122 ++++++++++++++-------------- sal/osl/unx/security.c | 14 +-- sal/osl/unx/signal.c | 12 +- sal/osl/unx/socket.c | 56 ++++++------- sal/osl/unx/system.c | 6 - sal/osl/unx/tempfile.c | 23 ++--- sal/osl/unx/thread.c | 2 sal/osl/unx/util.c | 2 sal/osl/w32/dllentry.c | 2 sal/osl/w32/security.c | 2 sal/osl/w32/thread.c | 16 +-- sal/osl/w32/time.c | 2 sal/rtl/source/alloc_arena.c | 64 +++++++-------- sal/rtl/source/alloc_cache.c | 140 ++++++++++++++++----------------- sal/rtl/source/alloc_global.c | 16 +-- sal/rtl/source/byteseq.c | 20 ++-- sal/rtl/source/locale.c | 8 - sal/rtl/source/rtl_process.c | 2 sal/rtl/source/tres.c | 20 ++-- sal/textenc/tencinfo.c | 2 sal/workben/t_readline.c | 12 +- soltools/cpp/_getopt.c | 4 soltools/cpp/_lex.c | 2 soltools/cpp/_mcrvalid.c | 10 +- soltools/cpp/_nlist.c | 2 soltools/mkdepend/main.c | 8 - 47 files changed, 441 insertions(+), 439 deletions(-)
New commits: commit 8d94f9e44da8f3fdf55b1d814f921cb6dbdc37a3 Author: Pedro Giffuni <p...@apache.org> Date: Sun Apr 10 02:30:31 2016 +0000 Replace 0 with NULL for pointers. Only applied to C code: common style for C++ is different. Found with coccinelle: http://coccinelle.lip6.fr/ diff --git a/desktop/source/pagein/file_image_unx.c b/desktop/source/pagein/file_image_unx.c index c530b5a..9c8309f 100644 --- a/desktop/source/pagein/file_image_unx.c +++ b/desktop/source/pagein/file_image_unx.c @@ -49,7 +49,7 @@ int file_image_open (file_image * image, const char * filename) struct stat st; void * p; - if (image == 0) + if (image == NULL) return (EINVAL); image->m_base = MAP_FAILED, image->m_size = 0; @@ -87,10 +87,10 @@ int file_image_pagein (file_image * image) size_t k; volatile char c = 0; - if (image == 0) + if (image == NULL) return (EINVAL); - if ((w.m_base = image->m_base) == 0) + if ((w.m_base = image->m_base) == NULL) return (EINVAL); if ((w.m_size = image->m_size) == 0) return (0); @@ -135,12 +135,12 @@ int file_image_pagein (file_image * image) */ int file_image_close (file_image * image) { - if (image == 0) + if (image == NULL) return (EINVAL); if (munmap (image->m_base, image->m_size) == -1) return (errno); - image->m_base = 0, image->m_size = 0; + image->m_base = NULL, image->m_size = 0; return (0); } diff --git a/desktop/source/pagein/pagein.c b/desktop/source/pagein/pagein.c index 84bf302..c601efc 100644 --- a/desktop/source/pagein/pagein.c +++ b/desktop/source/pagein/pagein.c @@ -70,7 +70,7 @@ int main (int argc, char **argv) for (i = 1; i < argc; i++) { - FILE * fp = 0; + FILE * fp = NULL; size_t k = 0; if (argv[i][0] == '-') @@ -99,10 +99,10 @@ int main (int argc, char **argv) } - if ((argv[i][0] == '@') && ((fp = fopen (argv[i], "r")) == 0)) + if ((argv[i][0] == '@') && ((fp = fopen (argv[i], "r")) == NULL)) { char path[1024]; - if ((fp = fopen (&(argv[i][1]), "r")) == 0) + if ((fp = fopen (&(argv[i][1]), "r")) == NULL) { fprintf (stderr, "fopen: %s\n", strerror(errno)); continue; @@ -124,7 +124,7 @@ int main (int argc, char **argv) } else { - if (fp != 0) + if (fp != NULL) fclose (fp); if (do_pagein (argv[i], &k) == 0) diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c index 29e970c..b7294d0 100644 --- a/rsc/source/rscpp/cpp3.c +++ b/rsc/source/rscpp/cpp3.c @@ -411,7 +411,7 @@ readoptions(char* filename, char*** pfargv) pfa[fargc+1]=malloc(strlen(optbuff)+1); strcpy(pfa[fargc+1],optbuff); fargc++; - pfa[fargc+1]=0; + pfa[fargc+1]=NULL; poptbuff=&optbuff[0]; } } diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c index 3be0327..2d81491 100644 --- a/rsc/source/rscpp/cpp4.c +++ b/rsc/source/rscpp/cpp4.c @@ -88,7 +88,7 @@ void dodefine() register int c; register DEFBUF *dp; /* -> new definition */ int isredefine; /* TRUE if redefined */ - char *old = 0; /* Remember redefined */ + char *old = NULL; /* Remember redefined */ if (type[(c = skipws())] != LET) goto bad_define; diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c index 19fd095..ff5513a 100644 --- a/sal/osl/os2/diagnose.c +++ b/sal/osl/os2/diagnose.c @@ -113,7 +113,7 @@ sal_Bool SAL_CALL osl_assertFailedLine( const sal_Char* pszFileName, sal_Int32 n /* format message into buffer */ sprintf(szMessage, "Assertion Failed: %s: File %s, Line %d:\n", lpszAppName, pszFileName, nLine); - if(pszMessage != 0) + if(pszMessage != NULL) strcat( szMessage, pszMessage ); szMessage[sizeof(szMessage)-1] = '\0'; diff --git a/sal/osl/os2/module.c b/sal/osl/os2/module.c index ee6dd26..37f0863 100644 --- a/sal/osl/os2/module.c +++ b/sal/osl/os2/module.c @@ -221,12 +221,12 @@ osl_getAsciiFunctionSymbol( oslModule Module, const sal_Char *pSymbol ) { PFN pFunction; APIRET rc; - void* pHandle=0; + void* pHandle=NULL; OSL_ENSURE(Module,"osl_getSymbol : module handle is not valid"); OSL_ENSURE(Module,"osl_getSymbol : ustrSymbolName"); - if ( Module!= 0 && pSymbol != 0 ) + if ( Module!= 0 && pSymbol != NULL ) { rc = DosQueryProcAddr( (HMODULE) Module, 0, (PCSZ)pSymbol, &pFunction ); diff --git a/sal/osl/os2/nlsupport.c b/sal/osl/os2/nlsupport.c index 1a3f100..0c33c3c 100644 --- a/sal/osl/os2/nlsupport.c +++ b/sal/osl/os2/nlsupport.c @@ -321,7 +321,7 @@ const _pair _iso_language_list[] = { rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) { - const _pair *language = 0; + const _pair *language = NULL; char locale_buf[64] = ""; char *cp; diff --git a/sal/osl/os2/process.c b/sal/osl/os2/process.c index 9fcc9bd..3080f6a 100644 --- a/sal/osl/os2/process.c +++ b/sal/osl/os2/process.c @@ -133,9 +133,9 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( { oslProcessError Error; - sal_Char* pszWorkDir=0; - sal_Char** pArguments=0; - sal_Char** pEnvironment=0; + sal_Char* pszWorkDir=NULL; + sal_Char** pArguments=NULL; + sal_Char** pEnvironment=NULL; unsigned int index; char szImagePath[PATH_MAX] = ""; @@ -168,13 +168,13 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( FileURLToPath( szImagePath, PATH_MAX, ustrImageName ); } - if ( ustrWorkDir != 0 && ustrWorkDir->length ) + if ( ustrWorkDir != NULL && ustrWorkDir->length ) { FileURLToPath( szWorkDir, PATH_MAX, ustrWorkDir ); pszWorkDir = szWorkDir; } - if ( pArguments == 0 && nArguments > 0 ) + if ( pArguments == NULL && nArguments > 0 ) { pArguments = (sal_Char**) malloc( ( nArguments + 2 ) * sizeof(sal_Char*) ); } @@ -182,7 +182,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( for ( index = 0 ; index < nArguments ; ++index ) { - rtl_String* strArg =0; + rtl_String* strArg =NULL; rtl_uString2String( &strArg, @@ -193,14 +193,14 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( pArguments[index]=strdup(rtl_string_getStr(strArg)); rtl_string_release(strArg); - pArguments[index+1]=0; + pArguments[index+1]=NULL; } for ( index = 0 ; index < nEnvironmentVars ; ++index ) { - rtl_String* strEnv=0; + rtl_String* strEnv=NULL; - if ( pEnvironment == 0 ) + if ( pEnvironment == NULL ) { pEnvironment = (sal_Char**) malloc( ( nEnvironmentVars + 2 ) * sizeof(sal_Char*) ); } @@ -213,7 +213,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( pEnvironment[index]=strdup(rtl_string_getStr(strEnv)); rtl_string_release(strEnv); - pEnvironment[index+1]=0; + pEnvironment[index+1]=NULL; } int rc, pid; @@ -279,11 +279,11 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( dup2( saveError, STDERR_FILENO); close( saveError); - if ( pArguments != 0 ) + if ( pArguments != NULL ) { for ( index = 0 ; index < nArguments ; ++index ) { - if ( pArguments[index] != 0 ) + if ( pArguments[index] != NULL ) { free(pArguments[index]); } @@ -291,11 +291,11 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( free(pArguments); } - if ( pEnvironment != 0 ) + if ( pEnvironment != NULL ) { for ( index = 0 ; index < nEnvironmentVars ; ++index ) { - if ( pEnvironment[index] != 0 ) + if ( pEnvironment[index] != NULL ) { free(pEnvironment[index]); } diff --git a/sal/osl/os2/profile.c b/sal/osl/os2/profile.c index fb31bd2..7f57a35 100644 --- a/sal/osl/os2/profile.c +++ b/sal/osl/os2/profile.c @@ -290,7 +290,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) OSL_TRACE("In osl_closeProfile\n"); #endif - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_closeProfile [profile==0]\n"); @@ -302,7 +302,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) { pProfile = acquireProfile(Profile,sal_True); - if ( pProfile != 0 ) + if ( pProfile != NULL ) { if ( !( pProfile->m_Flags & osl_Profile_READLOCK ) && ( pProfile->m_Flags & FLG_MODIFIED ) ) { @@ -317,7 +317,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) pProfile = acquireProfile(Profile,sal_False); } - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_closeProfile [pProfile==0]\n"); @@ -337,23 +337,23 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) if ( pProfile->m_NoLines > 0) { unsigned int index=0; - if ( pProfile->m_Lines != 0 ) + if ( pProfile->m_Lines != NULL ) { for ( index = 0 ; index < pProfile->m_NoLines ; ++index) { - if ( pProfile->m_Lines[index] != 0 ) + if ( pProfile->m_Lines[index] != NULL ) { free(pProfile->m_Lines[index]); } } free(pProfile->m_Lines); } - if ( pProfile->m_Sections != 0 ) + if ( pProfile->m_Sections != NULL ) { /*osl_TProfileSection* pSections=pProfile->m_Sections;*/ for ( index = 0 ; index < pProfile->m_NoSections ; ++index ) { - if ( pProfile->m_Sections[index].m_Entries != 0 ) + if ( pProfile->m_Sections[index].m_Entries != NULL ) { free(pProfile->m_Sections[index].m_Entries); } @@ -380,7 +380,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) OSL_TRACE("In osl_flushProfile()\n"); #endif - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_flushProfile() [pProfile == 0]\n"); @@ -389,7 +389,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) } pFile = pProfile->m_pFile; - if ( !( pFile != 0 && pFile->m_Handle >= 0 ) ) + if ( !( pFile != NULL && pFile->m_Handle >= 0 ) ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_flushProfile() [invalid file]\n"); @@ -417,9 +417,9 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, const sal_Char* pszDefault) { sal_uInt32 NoEntry; - const sal_Char* pStr = 0; + const sal_Char* pStr = NULL; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = NULL; #ifdef TRACE_OSL_PROFILE @@ -449,7 +449,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, else pStr = pszDefault; - if ( pStr != 0 ) + if ( pStr != NULL ) { pStr = stripBlanks(pStr, NULL); MaxLen = (MaxLen - 1 < strlen(pStr)) ? (MaxLen - 1) : strlen(pStr); @@ -465,7 +465,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, releaseProfile(pProfile); - if ( pStr == 0 ) + if ( pStr == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [pStr==0]\n"); @@ -557,7 +557,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, const sal_Char* pStr; sal_Char Line[4096]; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = NULL; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_writeProfileString\n"); @@ -700,7 +700,7 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, { sal_uInt32 NoEntry; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = NULL; sal_Bool bRet = sal_False; #ifdef TRACE_OSL_PROFILE @@ -758,7 +758,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C sal_uInt32 i, n = 0; sal_uInt32 NoEntry; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; + osl_TProfileImpl* pProfile = NULL; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_getProfileSectionEntries\n"); @@ -1151,8 +1151,8 @@ static osl_TFile* openFileImpl(rtl_uString *ustrFileName, oslProfileOption Profi ULONG flags; ULONG mode; sal_Bool bWriteable = sal_False; - rtl_String* strFileName=0; - sal_Char* pszFileName=0; + rtl_String* strFileName=NULL; + sal_Char* pszFileName=NULL; /* check parameters */ OSL_ASSERT( ustrFileName ); @@ -1206,7 +1206,7 @@ static osl_TFile* openFileImpl(rtl_uString *ustrFileName, oslProfileOption Profi rtl_string_release(strFileName); - pFile->m_pWriteBuf=0; + pFile->m_pWriteBuf=NULL; pFile->m_nWriteBufFree=0; pFile->m_nWriteBufLen=0; @@ -1231,7 +1231,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile) { osl_TStamp stamp = {0, 0}; - if ( pFile == 0 ) + if ( pFile == NULL ) { return stamp; } @@ -1256,7 +1256,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile) DosClose(pFile->m_Handle); } - if ( pFile->m_pWriteBuf != 0 ) + if ( pFile->m_pWriteBuf != NULL ) { free(pFile->m_pWriteBuf); } @@ -1383,12 +1383,12 @@ static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) int strLen=0; #endif - if ( pFile == 0 || pFile->m_Handle < 0 ) + if ( pFile == NULL || pFile->m_Handle < 0 ) { return (sal_False); } - if ( pFile->m_pWriteBuf == 0 ) + if ( pFile->m_pWriteBuf == NULL ) { pFile->m_pWriteBuf = (sal_Char*) malloc(Len+3); pFile->m_nWriteBufLen = Len+3; @@ -1401,7 +1401,7 @@ static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) sal_Char* pTmp; pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); - if ( pTmp == 0 ) + if ( pTmp == NULL ) { return sal_False; } @@ -1567,7 +1567,7 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 LineNo) } else { - pProfile->m_Lines[LineNo] = 0; + pProfile->m_Lines[LineNo] = NULL; } pProfile->m_NoLines--; @@ -1694,7 +1694,7 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect } else { - pSection->m_Entries = 0; + pSection->m_Entries = NULL; } pProfile->m_NoSections--; @@ -1921,7 +1921,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable) sal_Bool bWriteable = sal_False; char pszFilename[PATH_MAX] = ""; - if ( pProfile->m_strFileName != 0 && pProfile->m_strFileName->buffer[0] != 0 ) + if ( pProfile->m_strFileName != NULL && pProfile->m_strFileName->buffer[0] != 0 ) FileURLToPath( pszFilename, PATH_MAX, pProfile->m_strFileName ); /* hack: usually you have a specific HAB, but NULL works here... */ pProfile->m_hIni = PrfOpenProfile(NULL, (PCSZ)pszFilename); @@ -1939,7 +1939,7 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) OSL_TRACE("In releaseProfile\n"); #endif - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out releaseProfile [profile==0]\n"); diff --git a/sal/osl/os2/socket.c b/sal/osl/os2/socket.c index f0cf028..6c94bbe 100644 --- a/sal/osl/os2/socket.c +++ b/sal/osl/os2/socket.c @@ -693,11 +693,11 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr ( rtl_uString *ustrDottedAddr, sal_Int32 Port) { - rtl_String* strDottedAddr=0; + rtl_String* strDottedAddr=NULL; oslSocketAddr Addr; - sal_Char* pszDottedAddr=0; + sal_Char* pszDottedAddr=NULL; - if ( ustrDottedAddr != 0 ) + if ( ustrDottedAddr != NULL ) { rtl_uString2String( &strDottedAddr, rtl_uString_getStr(ustrDottedAddr), @@ -710,7 +710,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr ( Addr = osl_psz_createInetSocketAddr(pszDottedAddr, Port); - if ( strDottedAddr != 0 ) + if ( strDottedAddr != NULL ) { rtl_string_release(strDottedAddr); } @@ -1168,10 +1168,10 @@ oslHostAddr SAL_CALL osl_createHostAddr ( const oslSocketAddr Addr) { oslHostAddr HostAddr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1183,7 +1183,7 @@ oslHostAddr SAL_CALL osl_createHostAddr ( HostAddr = osl_psz_createHostAddr(pszHostName,Addr); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1230,10 +1230,10 @@ oslHostAddr SAL_CALL osl_psz_createHostAddr ( oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *ustrHostname) { oslHostAddr HostAddr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1245,7 +1245,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *ustrHostname) HostAddr = osl_psz_createHostAddrByName(pszHostName); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1320,7 +1320,7 @@ void SAL_CALL osl_getHostnameOfHostAddr ( const oslHostAddr Addr, rtl_uString **ustrHostname) { - const sal_Char* pHostname=0; + const sal_Char* pHostname=NULL; pHostname = osl_psz_getHostnameOfHostAddr(Addr); @@ -1480,10 +1480,10 @@ oslSocketResult SAL_CALL osl_psz_getLocalHostname ( oslSocketAddr SAL_CALL osl_resolveHostname(rtl_uString *ustrHostname) { oslSocketAddr Addr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1496,7 +1496,7 @@ oslSocketAddr SAL_CALL osl_resolveHostname(rtl_uString *ustrHostname) Addr = osl_psz_resolveHostname(pszHostName); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1528,12 +1528,12 @@ oslSocketAddr SAL_CALL osl_psz_resolveHostname(const sal_Char* pszHostname) sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString *ustrProtocol) { sal_Int32 nPort; - rtl_String* strServicename=0; - rtl_String* strProtocol=0; - sal_Char* pszServiceName=0; - sal_Char* pszProtocol=0; + rtl_String* strServicename=NULL; + rtl_String* strProtocol=NULL; + sal_Char* pszServiceName=NULL; + sal_Char* pszProtocol=NULL; - if ( ustrServicename != 0 ) + if ( ustrServicename != NULL ) { rtl_uString2String( &strServicename, rtl_uString_getStr(ustrServicename), @@ -1543,7 +1543,7 @@ sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString pszServiceName = rtl_string_getStr(strServicename); } - if ( ustrProtocol != 0 ) + if ( ustrProtocol != NULL ) { rtl_uString2String( &strProtocol, rtl_uString_getStr(ustrProtocol), @@ -1555,12 +1555,12 @@ sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString nPort = osl_psz_getServicePort(pszServiceName,pszProtocol); - if ( strServicename != 0 ) + if ( strServicename != NULL ) { rtl_string_release(strServicename); } - if ( strProtocol != 0 ) + if ( strProtocol != NULL ) { rtl_string_release(strProtocol); } @@ -1577,7 +1577,7 @@ sal_Int32 SAL_CALL osl_psz_getServicePort(const sal_Char* pszServicename, ps= getservbyname(pszServicename, pszProtocol); - if (ps != 0) + if (ps != NULL) return ntohs(ps->s_port); return OSL_INVALID_PORT; @@ -2350,7 +2350,7 @@ sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket pSocket, oslSocketMsgFlag Flag) { int nRead; - struct sockaddr *pSystemSockAddr = 0; + struct sockaddr *pSystemSockAddr = NULL; int AddrLen = 0; if( pSenderAddr ) { @@ -2440,7 +2440,7 @@ sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, { int nWritten; - struct sockaddr *pSystemSockAddr = 0; + struct sockaddr *pSystemSockAddr = NULL; int AddrLen = 0; if( ReceiverAddr ) { diff --git a/sal/osl/os2/tempfile.c b/sal/osl/os2/tempfile.c index 4f67efa..c1ebfd7 100644 --- a/sal/osl/os2/tempfile.c +++ b/sal/osl/os2/tempfile.c @@ -127,8 +127,8 @@ static oslFileError osl_setup_base_directory_impl_( rtl_uString* pustrDirectoryURL, rtl_uString** ppustr_base_dir) { - rtl_uString* dir_url = 0; - rtl_uString* dir = 0; + rtl_uString* dir_url = NULL; + rtl_uString* dir = NULL; oslFileError error = osl_File_E_None; if (pustrDirectoryURL) @@ -165,9 +165,10 @@ static oslFileError osl_setup_base_directory_impl_( { oslFileError osl_error; - OSL_PRECOND(((0 != pHandle) || (0 != ppustrTempFileURL)), "Invalid parameter!"); + OSL_PRECOND(((NULL != pHandle) || (NULL != ppustrTempFileURL)), + "Invalid parameter!"); - if ((0 == pHandle) && (0 == ppustrTempFileURL)) + if ((NULL == pHandle) && (NULL == ppustrTempFileURL)) { osl_error = osl_File_E_INVAL; } @@ -176,7 +177,7 @@ static oslFileError osl_setup_base_directory_impl_( osl_error = osl_setup_base_directory_impl_( pustrDirectoryURL, ppustr_base_dir); - *b_delete_on_close = (0 == ppustrTempFileURL); + *b_delete_on_close = (NULL == ppustrTempFileURL); } return osl_error; @@ -192,10 +193,10 @@ static oslFileError osl_create_temp_file_impl_( oslFileHandle* file_handle, rtl_uString** ppustr_temp_file_name) { - rtl_uString* rand_name = 0; + rtl_uString* rand_name = NULL; sal_uInt32 len_base_dir = 0; - rtl_uString* tmp_file_path = 0; - rtl_uString* tmp_file_url = 0; + rtl_uString* tmp_file_path = NULL; + rtl_uString* tmp_file_url = NULL; sal_Int32 capacity = 0; oslFileError osl_error = osl_File_E_None; sal_Int32 offset_file_name; @@ -296,8 +297,8 @@ oslFileError SAL_CALL osl_createTempFile( oslFileHandle* pHandle, rtl_uString** ppustrTempFileURL) { - rtl_uString* base_directory = 0; - rtl_uString* temp_file_name = 0; + rtl_uString* base_directory = NULL; + rtl_uString* temp_file_name = NULL; oslFileHandle temp_file_handle; sal_Bool b_delete_on_close; oslFileError osl_error; @@ -317,7 +318,7 @@ oslFileError SAL_CALL osl_createTempFile( if (osl_File_E_None == osl_error) { - rtl_uString* temp_file_url = 0; + rtl_uString* temp_file_url = NULL; /* assuming this works */ osl_getFileURLFromSystemPath(temp_file_name, &temp_file_url); diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c index 818f9db..d89d19f 100644 --- a/sal/osl/os2/thread.c +++ b/sal/osl/os2/thread.c @@ -377,7 +377,7 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments ?*/ - if(pThreadImpl==0 || pThreadImpl->m_ThreadId==-1) + if(pThreadImpl==NULL || pThreadImpl->m_ThreadId==-1) { return osl_Thread_PriorityUnknown; } @@ -451,7 +451,7 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) APIRET rc; /* invalid arguments ?*/ - if(pThreadImpl==0 || pThreadImpl->m_ThreadId==-1) + if(pThreadImpl==NULL || pThreadImpl->m_ThreadId==-1) { return sal_False; } @@ -472,7 +472,7 @@ void SAL_CALL osl_joinWithThread(oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments?*/ - if(pThreadImpl==0 || pThreadImpl->m_ThreadId==-1) + if(pThreadImpl==NULL || pThreadImpl->m_ThreadId==-1) { /* assume thread is not running */ return; @@ -503,7 +503,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments?*/ - if (pThreadImpl==0 || pThreadImpl->m_ThreadId==-1) + if (pThreadImpl==NULL || pThreadImpl->m_ThreadId==-1) { /* assume thread is not running */ return; @@ -525,7 +525,7 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) osl_yieldThread(); /* invalid arguments?*/ - if (pThreadImpl==0 || pThreadImpl->m_ThreadId==-1) + if (pThreadImpl==NULL || pThreadImpl->m_ThreadId==-1) { /* assume thread is not running */ return sal_False; @@ -577,7 +577,7 @@ static void AddKeyToList( PTLS pTls ) DosRequestMutexSem( MutexLock, SEM_INDEFINITE_WAIT ); pTls->pNext = g_pThreadKeyList; - pTls->pPrev = 0; + pTls->pPrev = NULL; if ( g_pThreadKeyList ) g_pThreadKeyList->pPrev = pTls; @@ -641,7 +641,7 @@ oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback if (DosAllocThreadLocalMemory(1, &pTls->pulPtr) != NO_ERROR) { rtl_freeMemory( pTls ); - pTls = 0; + pTls = NULL; } else { diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index fadd07b..e9d6133 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -78,11 +78,11 @@ int backtrace( void **buffer, int max_frames ) fpval = ((long*)(ctx))[FRAME_PTR_OFFSET]; fp = (struct frame*)((char*)(fpval) + STACK_BIAS); - for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) + for (i = 0; (i < FRAME_OFFSET) && (fp != NULL); i++) fp = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); /* iterate through backtrace */ - for (i = 0; (fp != 0) && (fp->fr_savpc != 0) && (i < max_frames); i++) + for (i = 0; (fp != NULL) && (fp->fr_savpc != 0) && (i < max_frames); i++) { /* saved (prev) frame */ struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); @@ -154,7 +154,7 @@ int backtrace( void **buffer, int max_frames ) /* get stack- and framepointer */ setjmp(ctx); fp = (struct frame*)(((size_t*)(ctx))[FRAME_PTR_OFFSET]); - for ( i=0; (i<FRAME_OFFSET) && (fp!=0); i++) + for ( i=0; (i<FRAME_OFFSET) && (fp!=NULL); i++) fp = fp->fr_savfp; /* iterate through backtrace */ for (i=0; fp && fp->fr_savpc && i<max_frames; i++) @@ -238,7 +238,7 @@ int backtrace( void **buffer, int max_frames ) /* get stack- and framepointer */ setjmp(ctx); fp = (struct frame*)(((size_t*)(ctx))[FRAME_PTR_OFFSET]); - for ( i=0; (i<FRAME_OFFSET) && (fp!=0); i++) + for ( i=0; (i<FRAME_OFFSET) && (fp!=NULL); i++) fp = fp->fr_savfp; /* iterate through backtrace */ diff --git a/sal/osl/unx/conditn.c b/sal/osl/unx/conditn.c index 814f399..1e2e7b3 100644 --- a/sal/osl/unx/conditn.c +++ b/sal/osl/unx/conditn.c @@ -50,7 +50,7 @@ oslCondition SAL_CALL osl_createCondition() OSL_ASSERT(pCond); - if ( pCond == 0 ) + if ( pCond == NULL ) { return 0; } @@ -82,7 +82,7 @@ oslCondition SAL_CALL osl_createCondition() } free(pCond); - pCond = 0; + pCond = NULL; } return (oslCondition)pCond; @@ -130,7 +130,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition) OSL_ASSERT(Condition); pCond = (oslConditionImpl*)Condition; - if ( pCond == 0 ) + if ( pCond == NULL ) { return sal_False; } @@ -177,7 +177,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition) pCond = (oslConditionImpl*)Condition; - if ( pCond == 0 ) + if ( pCond == NULL ) { return sal_False; } @@ -215,7 +215,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time OSL_ASSERT(Condition); pCond = (oslConditionImpl*)Condition; - if ( pCond == 0 ) + if ( pCond == NULL ) { return osl_cond_result_error; } @@ -320,7 +320,7 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition) OSL_ASSERT(Condition); pCond = (oslConditionImpl*)Condition; - if ( pCond == 0 ) + if ( pCond == NULL ) { return sal_False; } diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index 0f05fbe..7be25df 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -82,8 +82,8 @@ static void osl_diagnose_frame_Impl ( int depth, void * pc) { - const char *fname = 0, *sname = 0; - void *fbase = 0, *saddr = 0; + const char *fname = NULL, *sname = NULL; + void *fbase = NULL, *saddr = NULL; ptrdiff_t offset; char szMessage[1024]; @@ -183,10 +183,10 @@ static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) fpval = ((long*)(ctx))[FRAME_PTR_OFFSET]; fp = (struct frame*)((char*)(fpval) + STACK_BIAS); - for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) + for (i = 0; (i < FRAME_OFFSET) && (fp != NULL); i++) fp = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); - for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) + for (i = 0; (fp != NULL) && (fp->fr_savpc != 0); i++) { struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); @@ -215,10 +215,10 @@ static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) setjmp (ctx); fp = (struct frame*)(((long*)(ctx))[FRAME_PTR_OFFSET]); - for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) + for (i = 0; (i < FRAME_OFFSET) && (fp != NULL); i++) fp = fp->fr_savfp; - for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) + for (i = 0; (fp != NULL) && (fp->fr_savpc != 0); i++) { struct frame * prev = fp->fr_savfp; osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); @@ -263,7 +263,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( return doAbort; /* format message into buffer */ - if (pszMessage != 0) + if (pszMessage != NULL) { snprintf(szMessage, sizeof(szMessage), "Error: File %s, Line %" SAL_PRIdINT32 ": %s\n", diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 0a3af20..7867226 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -82,7 +82,7 @@ oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName, sal_Int32 void* pLib = dlopen(pszModuleName, rtld_mode); #if OSL_DEBUG_LEVEL > 1 - if (pLib == 0) + if (pLib == NULL) OSL_TRACE("error: osl_loadModule failed with %s\n", dlerror()); #endif /* OSL_DEBUG_LEVEL */ diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c index 9760c53..97ce79f 100644 --- a/sal/osl/unx/mutex.c +++ b/sal/osl/unx/mutex.c @@ -59,7 +59,7 @@ oslMutex SAL_CALL osl_createMutex() OSL_ASSERT(pMutex); - if ( pMutex == 0 ) + if ( pMutex == NULL ) { return 0; } @@ -75,7 +75,7 @@ oslMutex SAL_CALL osl_createMutex() nRet, strerror(nRet)); free(pMutex); - pMutex = 0; + pMutex = NULL; } pthread_mutexattr_destroy(&aMutexAttr); @@ -92,7 +92,7 @@ void SAL_CALL osl_destroyMutex(oslMutex Mutex) OSL_ASSERT(pMutex); - if ( pMutex != 0 ) + if ( pMutex != NULL ) { int nRet=0; @@ -118,7 +118,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex) OSL_ASSERT(pMutex); - if ( pMutex != 0 ) + if ( pMutex != NULL ) { int nRet=0; diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index 7b056aa..0172ac7 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -541,13 +541,13 @@ static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER; rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) { - const _pair *language=0; + const _pair *language=NULL; char locale_buf[64] = ""; char codeset_buf[64]; - char *ctype_locale = 0; - char *codeset = 0; + char *ctype_locale = NULL; + char *codeset = NULL; /* default to process locale if pLocale == NULL */ if( NULL == pLocale ) @@ -765,7 +765,7 @@ const _pair _iso_language_list[] = { rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) { - const _pair *language = 0; + const _pair *language = NULL; char locale_buf[64] = ""; char *cp; diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index 43a21a0..d1db9ce 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -135,10 +135,10 @@ void __osl_destroyPipeImpl(oslPipe pImpl) oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Options, oslSecurity Security) { oslPipe pPipe=0; - rtl_String* strPipeName=0; - sal_Char* pszPipeName=0; + rtl_String* strPipeName=NULL; + sal_Char* pszPipeName=NULL; - if ( ustrPipeName != 0 ) + if ( ustrPipeName != NULL ) { rtl_uString2String( &strPipeName, rtl_uString_getStr(ustrPipeName), @@ -148,7 +148,7 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Option pszPipeName = rtl_string_getStr(strPipeName); pPipe = osl_psz_createPipe(pszPipeName, Options, Security); - if ( strPipeName != 0 ) + if ( strPipeName != NULL ) { rtl_string_release(strPipeName); } diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index dd07d4e..3b93ecd 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -155,7 +155,7 @@ oslProcessError SAL_CALL osl_searchPath_impl(const sal_Char* pszName, const sal_ OSL_ASSERT(pszName != NULL); - if ( pszName == 0 ) + if ( pszName == NULL ) { return osl_Process_E_NotFound; } @@ -167,7 +167,7 @@ oslProcessError SAL_CALL osl_searchPath_impl(const sal_Char* pszName, const sal_ Separator = ':'; - if ( (pchr = getenv(pszPath)) != 0 ) + if ( (pchr = getenv(pszPath)) != NULL ) { sal_Char *pstr; @@ -693,9 +693,9 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( { oslProcessError Error; - sal_Char* pszWorkDir=0; - sal_Char** pArguments=0; - sal_Char** pEnvironment=0; + sal_Char* pszWorkDir=NULL; + sal_Char** pArguments=NULL; + sal_Char** pEnvironment=NULL; unsigned int idx; char szImagePath[PATH_MAX] = ""; @@ -706,13 +706,13 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( FileURLToPath( szImagePath, PATH_MAX, ustrImageName ); } - if ( ustrWorkDir != 0 && ustrWorkDir->length ) + if ( ustrWorkDir != NULL && ustrWorkDir->length ) { FileURLToPath( szWorkDir, PATH_MAX, ustrWorkDir ); pszWorkDir = szWorkDir; } - if ( pArguments == 0 && nArguments > 0 ) + if ( pArguments == NULL && nArguments > 0 ) { pArguments = (sal_Char**) malloc( ( nArguments + 2 ) * sizeof(sal_Char*) ); } @@ -720,7 +720,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( for ( idx = 0 ; idx < nArguments ; ++idx ) { - rtl_String* strArg =0; + rtl_String* strArg =NULL; rtl_uString2String( &strArg, @@ -731,14 +731,14 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( pArguments[idx]=strdup(rtl_string_getStr(strArg)); rtl_string_release(strArg); - pArguments[idx+1]=0; + pArguments[idx+1]=NULL; } for ( idx = 0 ; idx < nEnvironmentVars ; ++idx ) { - rtl_String* strEnv=0; + rtl_String* strEnv=NULL; - if ( pEnvironment == 0 ) + if ( pEnvironment == NULL ) { pEnvironment = (sal_Char**) malloc( ( nEnvironmentVars + 2 ) * sizeof(sal_Char*) ); } @@ -751,7 +751,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( pEnvironment[idx]=strdup(rtl_string_getStr(strEnv)); rtl_string_release(strEnv); - pEnvironment[idx+1]=0; + pEnvironment[idx+1]=NULL; } @@ -767,11 +767,11 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( pErrorRead ); - if ( pArguments != 0 ) + if ( pArguments != NULL ) { for ( idx = 0 ; idx < nArguments ; ++idx ) { - if ( pArguments[idx] != 0 ) + if ( pArguments[idx] != NULL ) { free(pArguments[idx]); } @@ -779,11 +779,11 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( free(pArguments); } - if ( pEnvironment != 0 ) + if ( pEnvironment != NULL ) { for ( idx = 0 ; idx < nEnvironmentVars ; ++idx ) { - if ( pEnvironment[idx] != 0 ) + if ( pEnvironment[idx] != NULL ) { free(pEnvironment[idx]); } @@ -859,7 +859,7 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, OSL_ASSERT(pszImageName != NULL); - if ( pszImageName == 0 ) + if ( pszImageName == NULL ) { return osl_Process_E_NotFound; } @@ -869,7 +869,7 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, pszImageName = path; Data.m_pszArgs[0] = strdup(pszImageName); - Data.m_pszArgs[1] = 0; + Data.m_pszArgs[1] = NULL; if ( pszArguments != 0 ) { @@ -920,7 +920,7 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, for (i = 0; Data.m_pszEnv[i] != NULL; i++) free((void *)Data.m_pszEnv[i]); - if ( Data.m_pszDir != 0 ) + if ( Data.m_pszDir != NULL ) { free((void *)Data.m_pszDir); } @@ -1159,7 +1159,7 @@ sal_Bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) if ((fd = open(name,O_RDONLY)) >=0 ) { - char* tmp=0; + char* tmp=NULL; char prstatbuf[512]; memset(prstatbuf,0,512); bRet = read(fd,prstatbuf,511) == 511; @@ -1213,7 +1213,7 @@ sal_Bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) if ((fd = open(name,O_RDONLY)) >=0 ) { - char* tmp=0; + char* tmp=NULL; char prstatusbuf[512]; memset(prstatusbuf,0,512); bRet = read(fd,prstatusbuf,511) == 511; diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c index d453266..68112e0 100644 --- a/sal/osl/unx/profile.c +++ b/sal/osl/unx/profile.c @@ -181,7 +181,7 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *ustrProfileName, oslProfileOpti { char profilePath[PATH_MAX] = ""; - if ( ustrProfileName != 0 && ustrProfileName->buffer[0] != 0 ) + if ( ustrProfileName != NULL && ustrProfileName->buffer[0] != 0 ) FileURLToPath( profilePath, PATH_MAX, ustrProfileName ); return osl_psz_openProfile( profilePath,Options ); @@ -239,7 +239,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o pProfile = calloc(1, sizeof(osl_TProfileImpl)); - if ( pProfile == 0 ) + if ( pProfile == NULL ) { return 0; } @@ -303,7 +303,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) { pProfile = acquireProfile(Profile,sal_True); - if ( pProfile != 0 ) + if ( pProfile != NULL ) { bRet=storeProfile(pProfile, sal_True); OSL_ASSERT(bRet); @@ -315,7 +315,7 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) } - if ( pProfile == 0 ) + if ( pProfile == NULL ) { pthread_mutex_unlock(&(pProfile->m_AccessLock)); #ifdef TRACE_OSL_PROFILE @@ -334,32 +334,32 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) if ( pProfile->m_NoLines > 0) { unsigned int idx=0; - if ( pProfile->m_Lines != 0 ) + if ( pProfile->m_Lines != NULL ) { for ( idx = 0 ; idx < pProfile->m_NoLines ; ++idx) { - if ( pProfile->m_Lines[idx] != 0 ) + if ( pProfile->m_Lines[idx] != NULL ) { free(pProfile->m_Lines[idx]); - pProfile->m_Lines[idx]=0; + pProfile->m_Lines[idx]=NULL; } } free(pProfile->m_Lines); - pProfile->m_Lines=0; + pProfile->m_Lines=NULL; } - if ( pProfile->m_Sections != 0 ) + if ( pProfile->m_Sections != NULL ) { /*osl_TProfileSection* pSections=pProfile->m_Sections;*/ for ( idx = 0 ; idx < pProfile->m_NoSections ; ++idx ) { - if ( pProfile->m_Sections[idx].m_Entries != 0 ) + if ( pProfile->m_Sections[idx].m_Entries != NULL ) { free(pProfile->m_Sections[idx].m_Entries); - pProfile->m_Sections[idx].m_Entries=0; + pProfile->m_Sections[idx].m_Entries=NULL; } } free(pProfile->m_Sections); - pProfile->m_Sections=0; + pProfile->m_Sections=NULL; } } @@ -386,7 +386,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) OSL_TRACE("In osl_flushProfile()\n"); #endif - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_flushProfile() [pProfile == 0]\n"); @@ -407,7 +407,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile) } pFile = pProfile->m_pFile; - if ( !( pFile != 0 && pFile->m_Handle >= 0 ) ) + if ( !( pFile != NULL && pFile->m_Handle >= 0 ) ) { pthread_mutex_unlock(&(pProfile->m_AccessLock)); #ifdef TRACE_OSL_PROFILE @@ -443,7 +443,7 @@ static sal_Bool writeProfileImpl(osl_TFile* pFile) OSL_TRACE("In osl_writeProfileImpl()\n"); #endif - if ( !( pFile != 0 && pFile->m_Handle >= 0 ) || ( pFile->m_pWriteBuf == 0 ) ) + if ( !( pFile != NULL && pFile->m_Handle >= 0 ) || ( pFile->m_pWriteBuf == NULL ) ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileImpl() [invalid args]\n"); @@ -470,7 +470,7 @@ static sal_Bool writeProfileImpl(osl_TFile* pFile) #endif free(pFile->m_pWriteBuf); - pFile->m_pWriteBuf=0; + pFile->m_pWriteBuf=NULL; pFile->m_nWriteBufLen=0; pFile->m_nWriteBufFree=0; #ifdef TRACE_OSL_PROFILE @@ -486,10 +486,10 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, const sal_Char* pszDefault) { sal_uInt32 NoEntry; - sal_Char* pStr=0; + sal_Char* pStr=NULL; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile=0; - osl_TProfileImpl* pTmpProfile=0; + osl_TProfileImpl* pProfile=NULL; + osl_TProfileImpl* pTmpProfile=NULL; sal_Bool bRet = sal_False; #ifdef TRACE_OSL_PROFILE @@ -498,7 +498,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, pTmpProfile = (osl_TProfileImpl*) Profile; - if ( pTmpProfile == 0 ) + if ( pTmpProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [pTmpProfile==0]\n"); @@ -541,7 +541,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, pStr=(sal_Char*)pszDefault; } - if ( pStr != 0 ) + if ( pStr != NULL ) { pStr = stripBlanks(pStr, NULL); MaxLen = (MaxLen - 1 < strlen(pStr)) ? (MaxLen - 1) : strlen(pStr); @@ -557,7 +557,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, bRet=releaseProfile(pProfile); OSL_ASSERT(bRet); - if ( pStr == 0 ) + if ( pStr == NULL ) { pthread_mutex_unlock(&(pTmpProfile->m_AccessLock)); #ifdef TRACE_OSL_PROFILE @@ -649,10 +649,10 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, sal_Bool bRet = sal_False; sal_uInt32 NoEntry; sal_Char* pStr; - sal_Char* Line = 0; + sal_Char* Line = NULL; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; - osl_TProfileImpl* pTmpProfile = 0; + osl_TProfileImpl* pProfile = NULL; + osl_TProfileImpl* pTmpProfile = NULL; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_writeProfileString\n"); @@ -660,7 +660,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, pTmpProfile = (osl_TProfileImpl*) Profile; - if ( pTmpProfile == 0 ) + if ( pTmpProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_writeProfileString [pTmpProfile==0]\n"); @@ -772,7 +772,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, OSL_ASSERT(bRet); pthread_mutex_unlock(&(pTmpProfile->m_AccessLock)); - if ( Line!= 0 ) + if ( Line!= NULL ) { free(Line); } @@ -839,8 +839,8 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, { sal_uInt32 NoEntry; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; - osl_TProfileImpl* pTmpProfile = 0; + osl_TProfileImpl* pProfile = NULL; + osl_TProfileImpl* pTmpProfile = NULL; sal_Bool bRet = sal_False; #ifdef TRACE_OSL_PROFILE @@ -849,7 +849,7 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, pTmpProfile = (osl_TProfileImpl*) Profile; - if ( pTmpProfile == 0 ) + if ( pTmpProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_removeProfileEntry [pProfile==0]\n"); @@ -925,8 +925,8 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C sal_uInt32 i, n = 0; sal_uInt32 NoEntry; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; - osl_TProfileImpl* pTmpProfile = 0; + osl_TProfileImpl* pProfile = NULL; + osl_TProfileImpl* pTmpProfile = NULL; sal_Bool bRet = sal_False; #ifdef TRACE_OSL_PROFILE @@ -935,7 +935,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C pTmpProfile = (osl_TProfileImpl*) Profile; - if ( pTmpProfile == 0 ) + if ( pTmpProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_getProfileSectionEntries [pTmpProfile==0]\n"); @@ -1026,8 +1026,8 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff { sal_uInt32 i, n = 0; osl_TProfileSection* pSec; - osl_TProfileImpl* pProfile = 0; - osl_TProfileImpl* pTmpProfile = 0; + osl_TProfileImpl* pProfile = NULL; + osl_TProfileImpl* pTmpProfile = NULL; sal_Bool bRet = sal_False; #ifdef TRACE_OSL_PROFILE @@ -1036,7 +1036,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff pTmpProfile = (osl_TProfileImpl*) Profile; - if ( pTmpProfile == 0 ) + if ( pTmpProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_getProfileSections [pTmpProfile==0]\n"); @@ -1146,7 +1146,7 @@ static sal_Bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode) sal_Char* pEnvValue; pEnvValue = getenv( "STAR_PROFILE_LOCKING_DISABLED" ); - if ( pEnvValue == 0 ) + if ( pEnvValue == NULL ) { bLockingDisabled = sal_False; @@ -1263,7 +1263,7 @@ static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption Pro fcntl(pFile->m_Handle, F_SETFD, Flags); } - pFile->m_pWriteBuf=0; + pFile->m_pWriteBuf=NULL; pFile->m_nWriteBufFree=0; pFile->m_nWriteBufLen=0; @@ -1289,7 +1289,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags) OSL_TRACE("In closeFileImpl\n"); #endif - if ( pFile == 0 ) + if ( pFile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out closeFileImpl [pFile == 0]\n"); @@ -1365,7 +1365,7 @@ static sal_Char* OslProfile_getLine(osl_TFile* pFile) sal_Char* pLine = NULL; sal_Char* pNewLine; - if ( pFile == 0 ) + if ( pFile == NULL ) { return 0; } @@ -1454,12 +1454,12 @@ static sal_Bool OslProfile_putLine(osl_TFile* pFile, const sal_Char *pszLine) int strLen=0; #endif - if ( pFile == 0 || pFile->m_Handle < 0 ) + if ( pFile == NULL || pFile->m_Handle < 0 ) { return (sal_False); } - if ( pFile->m_pWriteBuf == 0 ) + if ( pFile->m_pWriteBuf == NULL ) { pFile->m_pWriteBuf = malloc(Len+3); pFile->m_nWriteBufLen = Len+3; @@ -1472,7 +1472,7 @@ static sal_Bool OslProfile_putLine(osl_TFile* pFile, const sal_Char *pszLine) sal_Char* pTmp; pTmp= realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); - if ( pTmp == 0 ) + if ( pTmp == NULL ) { return sal_False; } @@ -1538,7 +1538,7 @@ static sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) pProfile->m_MaxLines * sizeof(sal_Char *)); for ( idx = oldmax ; idx < pProfile->m_MaxLines ; ++idx ) { - pProfile->m_Lines[idx]=0; + pProfile->m_Lines[idx]=NULL; } } @@ -1551,7 +1551,7 @@ static sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) } - if ( pProfile->m_Lines != 0 && pProfile->m_Lines[pProfile->m_NoLines] != 0 ) + if ( pProfile->m_Lines != NULL && pProfile->m_Lines[pProfile->m_NoLines] != NULL ) { free(pProfile->m_Lines[pProfile->m_NoLines]); } @@ -1625,7 +1625,7 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 LineNo) if (LineNo < pProfile->m_NoLines) { free(pProfile->m_Lines[LineNo]); - pProfile->m_Lines[LineNo]=0; + pProfile->m_Lines[LineNo]=NULL; if (pProfile->m_NoLines - LineNo > 1) { sal_uInt32 i, n; @@ -1653,7 +1653,7 @@ static void removeLine(osl_TProfileImpl* pProfile, sal_uInt32 LineNo) } else { - pProfile->m_Lines[LineNo] = 0; + pProfile->m_Lines[LineNo] = NULL; } pProfile->m_NoLines--; @@ -1753,7 +1753,7 @@ static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* pProfile->m_MaxSections * sizeof(osl_TProfileSection)); for ( idx = oldmax ; idx < pProfile->m_MaxSections ; ++idx ) { - pProfile->m_Sections[idx].m_Entries=0; + pProfile->m_Sections[idx].m_Entries=NULL; } } @@ -1767,7 +1767,7 @@ static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* pProfile->m_NoSections++; - if ( pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries != 0 ) + if ( pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries != NULL ) { free(pProfile->m_Sections[(pProfile->m_NoSections) - 1].m_Entries); } @@ -1789,7 +1789,7 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect if ((Section = pSection - pProfile->m_Sections) < pProfile->m_NoSections) { free (pSection->m_Entries); - pSection->m_Entries=0; + pSection->m_Entries=NULL; if (pProfile->m_NoSections - Section > 1) { memmove(&pProfile->m_Sections[Section], &pProfile->m_Sections[Section + 1], @@ -1798,11 +1798,11 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect memset(&pProfile->m_Sections[pProfile->m_NoSections - 1], 0, (pProfile->m_MaxSections - pProfile->m_NoSections) * sizeof(osl_TProfileSection)); - pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = 0; + pProfile->m_Sections[pProfile->m_NoSections - 1].m_Entries = NULL; } else { - pSection->m_Entries = 0; + pSection->m_Entries = NULL; } pProfile->m_NoSections--; @@ -1818,7 +1818,7 @@ static sal_uInt32 Sect = 0; sal_uInt32 i, n; sal_uInt32 Len; const sal_Char* pStr; - osl_TProfileSection* pSec=0; + osl_TProfileSection* pSec=NULL; Len = strlen(Section); @@ -1874,19 +1874,19 @@ static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) pProfile->m_NoLines = 0; pProfile->m_NoSections = 0; - if ( pFile == 0 ) + if ( pFile == NULL ) { return sal_False; } - if ( pProfile == 0 ) + if ( pProfile == NULL ) { return sal_False; } OSL_VERIFY(OslProfile_rewindFile(pFile, sal_False)); - while ( ( pLine=OslProfile_getLine(pFile) ) != 0 ) + while ( ( pLine=OslProfile_getLine(pFile) ) != NULL ) { bWasAdded = addLine( pProfile, pLine ); rtl_freeMemory( pLine ); @@ -1951,7 +1951,7 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) osl_TFile* pTmpFile = osl_openTmpProfileImpl(pProfile); - if ( pTmpFile == 0 ) + if ( pTmpFile == NULL ) { return sal_False; } @@ -1965,12 +1965,12 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) if ( ! writeProfileImpl(pTmpFile) ) { - if ( pTmpFile->m_pWriteBuf != 0 ) + if ( pTmpFile->m_pWriteBuf != NULL ) { free(pTmpFile->m_pWriteBuf); } - pTmpFile->m_pWriteBuf=0; + pTmpFile->m_pWriteBuf=NULL; pTmpFile->m_nWriteBufLen=0; pTmpFile->m_nWriteBufFree=0; @@ -2022,7 +2022,7 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup) static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) { - osl_TFile* pFile=0; + osl_TFile* pFile=NULL; sal_Char* pszExtension = "tmp"; sal_Char pszTmpName[PATH_MAX]; oslProfileOption PFlags=0; @@ -2173,7 +2173,7 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) OSL_TRACE("In releaseProfile\n"); #endif - if ( pProfile == 0 ) + if ( pProfile == NULL ) { #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out releaseProfile [profile==0]\n"); diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index ee53b24..23bf3c1 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -449,12 +449,12 @@ oslSecurityError SAL_CALL osl_loginUser( ) { oslSecurityError Error; - rtl_String* strUserName=0; - rtl_String* strPassword=0; - sal_Char* pszUserName=0; - sal_Char* pszPassword=0; + rtl_String* strUserName=NULL; + rtl_String* strPassword=NULL; + sal_Char* pszUserName=NULL; + sal_Char* pszPassword=NULL; - if ( ustrUserName != 0 ) + if ( ustrUserName != NULL ) { rtl_uString2String( &strUserName, @@ -466,7 +466,7 @@ oslSecurityError SAL_CALL osl_loginUser( } - if ( ustrPassword != 0 ) + if ( ustrPassword != NULL ) { rtl_uString2String( &strPassword, rtl_uString_getStr(ustrPassword), @@ -479,7 +479,7 @@ oslSecurityError SAL_CALL osl_loginUser( Error=osl_psz_loginUser(pszUserName,pszPassword,pSecurity); - if ( strUserName != 0 ) + if ( strUserName != NULL ) { rtl_string_release(strUserName); } diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c index 1112764..aa6dda6 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.c @@ -161,13 +161,13 @@ static void SignalHandlerFunction(int); static void getExecutableName_Impl (rtl_String ** ppstrProgName) { - rtl_uString * ustrProgFile = 0; + rtl_uString * ustrProgFile = NULL; osl_getExecutableFile (&ustrProgFile); if (ustrProgFile) { - rtl_uString * ustrProgName = 0; + rtl_uString * ustrProgName = NULL; osl_systemPathGetFileNameOrLastDirectoryPart (ustrProgFile, &ustrProgName); - if (ustrProgName != 0) + if (ustrProgName != NULL) { rtl_uString2String ( ppstrProgName, @@ -183,7 +183,7 @@ static void getExecutableName_Impl (rtl_String ** ppstrProgName) static sal_Bool is_soffice_Impl (void) { sal_Int32 idx = -1; - rtl_String * strProgName = 0; + rtl_String * strProgName = NULL; getExecutableName_Impl (&strProgName); if (strProgName) @@ -205,7 +205,7 @@ static sal_Bool InitSignal() { sal_uInt32 argi; sal_uInt32 argc; - rtl_uString *ustrCommandArg = 0; + rtl_uString *ustrCommandArg = NULL; argc = osl_getCommandArgCount(); for ( argi = 0; argi < argc; argi++ ) @@ -222,7 +222,7 @@ static sal_Bool InitSignal() if (ustrCommandArg) { rtl_uString_release (ustrCommandArg); - ustrCommandArg = 0; + ustrCommandArg = NULL; } // WORKAROUND FOR SEGV HANDLER CONFLICT diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index 9bd877a..519c944 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -693,11 +693,11 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr ( rtl_uString *ustrDottedAddr, sal_Int32 Port) { - rtl_String* strDottedAddr=0; + rtl_String* strDottedAddr=NULL; oslSocketAddr Addr; - sal_Char* pszDottedAddr=0; + sal_Char* pszDottedAddr=NULL; - if ( ustrDottedAddr != 0 ) + if ( ustrDottedAddr != NULL ) { rtl_uString2String( &strDottedAddr, rtl_uString_getStr(ustrDottedAddr), @@ -710,7 +710,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr ( Addr = osl_psz_createInetSocketAddr(pszDottedAddr, Port); - if ( strDottedAddr != 0 ) + if ( strDottedAddr != NULL ) { rtl_string_release(strDottedAddr); } @@ -1149,10 +1149,10 @@ oslHostAddr SAL_CALL osl_createHostAddr ( const oslSocketAddr Addr) { oslHostAddr HostAddr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1164,7 +1164,7 @@ oslHostAddr SAL_CALL osl_createHostAddr ( HostAddr = osl_psz_createHostAddr(pszHostName,Addr); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1210,10 +1210,10 @@ oslHostAddr SAL_CALL osl_psz_createHostAddr ( oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *ustrHostname) { oslHostAddr HostAddr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1225,7 +1225,7 @@ oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *ustrHostname) HostAddr = osl_psz_createHostAddrByName(pszHostName); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1300,7 +1300,7 @@ void SAL_CALL osl_getHostnameOfHostAddr ( const oslHostAddr Addr, rtl_uString **ustrHostname) { - const sal_Char* pHostname=0; + const sal_Char* pHostname=NULL; pHostname = osl_psz_getHostnameOfHostAddr(Addr); @@ -1459,10 +1459,10 @@ oslSocketResult SAL_CALL osl_psz_getLocalHostname ( oslSocketAddr SAL_CALL osl_resolveHostname(rtl_uString *ustrHostname) { oslSocketAddr Addr; - rtl_String* strHostname=0; - sal_Char* pszHostName=0; + rtl_String* strHostname=NULL; + sal_Char* pszHostName=NULL; - if ( ustrHostname != 0 ) + if ( ustrHostname != NULL ) { rtl_uString2String( &strHostname, rtl_uString_getStr(ustrHostname), @@ -1475,7 +1475,7 @@ oslSocketAddr SAL_CALL osl_resolveHostname(rtl_uString *ustrHostname) Addr = osl_psz_resolveHostname(pszHostName); - if ( strHostname != 0 ) + if ( strHostname != NULL ) { rtl_string_release(strHostname); } @@ -1507,12 +1507,12 @@ oslSocketAddr SAL_CALL osl_psz_resolveHostname(const sal_Char* pszHostname) sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString *ustrProtocol) { sal_Int32 nPort; - rtl_String* strServicename=0; - rtl_String* strProtocol=0; - sal_Char* pszServiceName=0; - sal_Char* pszProtocol=0; + rtl_String* strServicename=NULL; + rtl_String* strProtocol=NULL; + sal_Char* pszServiceName=NULL; + sal_Char* pszProtocol=NULL; - if ( ustrServicename != 0 ) + if ( ustrServicename != NULL ) { rtl_uString2String( &strServicename, rtl_uString_getStr(ustrServicename), @@ -1522,7 +1522,7 @@ sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString pszServiceName = rtl_string_getStr(strServicename); } - if ( ustrProtocol != 0 ) + if ( ustrProtocol != NULL ) { rtl_uString2String( &strProtocol, rtl_uString_getStr(ustrProtocol), @@ -1534,12 +1534,12 @@ sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *ustrServicename, rtl_uString nPort = osl_psz_getServicePort(pszServiceName,pszProtocol); - if ( strServicename != 0 ) + if ( strServicename != NULL ) { rtl_string_release(strServicename); } - if ( strProtocol != 0 ) + if ( strProtocol != NULL ) { rtl_string_release(strProtocol); } @@ -1556,7 +1556,7 @@ sal_Int32 SAL_CALL osl_psz_getServicePort(const sal_Char* pszServicename, ps= getservbyname(pszServicename, pszProtocol); - if (ps != 0) + if (ps != NULL) return ntohs(ps->s_port); return OSL_INVALID_PORT; @@ -2312,7 +2312,7 @@ sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket pSocket, oslSocketMsgFlag Flag) { int nRead; - struct sockaddr *pSystemSockAddr = 0; + struct sockaddr *pSystemSockAddr = NULL; socklen_t AddrLen = 0; if( pSenderAddr ) { @@ -2402,7 +2402,7 @@ sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, { int nWritten; - struct sockaddr *pSystemSockAddr = 0; + struct sockaddr *pSystemSockAddr = NULL; int AddrLen = 0; if( ReceiverAddr ) { diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index 94e4893..6dc8d98 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -76,7 +76,7 @@ struct passwd *getpwnam_r(const char* name, struct passwd* s, char* buffer, int res = s; } else - res = 0; + res = NULL; } pthread_mutex_unlock(&getrtl_mutex); @@ -212,7 +212,7 @@ struct spwd *getspnam_r(const char *name, struct spwd* s, char* buffer, int size res = s; } else - res = 0; + res = NULL; } pthread_mutex_unlock(&getrtl_mutex); @@ -273,7 +273,7 @@ struct passwd *getpwnam_r(const char* name, struct passwd* s, char* buffer, int res = s; } else - res = 0; + res = NULL; } pthread_mutex_unlock(&getrtl_mutex); diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c index c082198..99b0ca2 100644 --- a/sal/osl/unx/tempfile.c +++ b/sal/osl/unx/tempfile.c @@ -138,8 +138,8 @@ static oslFileError osl_setup_base_directory_impl_( rtl_uString* pustrDirectoryURL, rtl_uString** ppustr_base_dir) { - rtl_uString* dir_url = 0; - rtl_uString* dir = 0; + rtl_uString* dir_url = NULL; + rtl_uString* dir = NULL; oslFileError error = osl_File_E_None; if (pustrDirectoryURL) @@ -176,9 +176,10 @@ static oslFileError osl_setup_base_directory_impl_( { oslFileError osl_error; - OSL_PRECOND(((0 != pHandle) || (0 != ppustrTempFileURL)), "Invalid parameter!"); + OSL_PRECOND(((NULL != pHandle) || (NULL != ppustrTempFileURL)), + "Invalid parameter!"); - if ((0 == pHandle) && (0 == ppustrTempFileURL)) + if ((NULL == pHandle) && (NULL == ppustrTempFileURL)) { osl_error = osl_File_E_INVAL; } @@ -187,7 +188,7 @@ static oslFileError osl_setup_base_directory_impl_( osl_error = osl_setup_base_directory_impl_( pustrDirectoryURL, ppustr_base_dir); - *b_delete_on_close = (0 == ppustrTempFileURL); + *b_delete_on_close = (NULL == ppustrTempFileURL); } return osl_error; @@ -203,10 +204,10 @@ static oslFileError osl_create_temp_file_impl_( oslFileHandle* file_handle, rtl_uString** ppustr_temp_file_name) { - rtl_uString* rand_name = 0; + rtl_uString* rand_name = NULL; sal_uInt32 len_base_dir = 0; - rtl_uString* tmp_file_path = 0; - rtl_uString* tmp_file_url = 0; + rtl_uString* tmp_file_path = NULL; + rtl_uString* tmp_file_url = NULL; sal_Int32 capacity = 0; oslFileError osl_error = osl_File_E_None; sal_Int32 offset_file_name; @@ -307,8 +308,8 @@ oslFileError SAL_CALL osl_createTempFile( oslFileHandle* pHandle, rtl_uString** ppustrTempFileURL) { - rtl_uString* base_directory = 0; - rtl_uString* temp_file_name = 0; + rtl_uString* base_directory = NULL; + rtl_uString* temp_file_name = NULL; oslFileHandle temp_file_handle; sal_Bool b_delete_on_close; oslFileError osl_error; @@ -328,7 +329,7 @@ oslFileError SAL_CALL osl_createTempFile( if (osl_File_E_None == osl_error) { - rtl_uString* temp_file_url = 0; + rtl_uString* temp_file_url = NULL; /* assuming this works */ osl_getFileURLFromSystemPath(temp_file_name, &temp_file_url); diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 6cad8fa..110bf60 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -186,7 +186,7 @@ static void osl_thread_destruct_Impl (Thread_Impl ** ppImpl) pthread_mutex_destroy (&((*ppImpl)->m_Lock)); free (*ppImpl); - (*ppImpl) = 0; + (*ppImpl) = NULL; } } diff --git a/sal/osl/unx/util.c b/sal/osl/unx/util.c index a6a40f9..1930c45 100644 --- a/sal/osl/unx/util.c +++ b/sal/osl/unx/util.c @@ -64,7 +64,7 @@ sal_Bool SAL_CALL osl_getEthernetAddress( sal_uInt8 * pAddr ) return sal_False; #else - if ( pAddr == 0 ) + if ( pAddr == NULL ) { return sal_False; } diff --git a/sal/osl/w32/dllentry.c b/sal/osl/w32/dllentry.c index 72e3df4..8717f49 100644 --- a/sal/osl/w32/dllentry.c +++ b/sal/osl/w32/dllentry.c @@ -128,7 +128,7 @@ __do_global_ctors (void) */ if (nptrs == -1) { - for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++) + for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != NULL; nptrs++) ; } diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c index a3e3c18..7299985 100644 --- a/sal/osl/w32/security.c +++ b/sal/osl/w32/security.c @@ -605,7 +605,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security) if (fLoadUserProfile && fUnloadUserProfile) { - rtl_uString *buffer = 0; + rtl_uString *buffer = NULL; PROFILEINFOW pi; getUserNameImpl(Security, &buffer, sal_False); diff --git a/sal/osl/w32/thread.c b/sal/osl/w32/thread.c index 563ca97..0a75df9 100755 --- a/sal/osl/w32/thread.c +++ b/sal/osl/w32/thread.c @@ -82,7 +82,7 @@ static oslThread oslCreateThread(oslWorkerFunction pWorker, OSL_ASSERT(pThreadImpl); - if ( pThreadImpl == 0 ) + if ( pThreadImpl == NULL ) { return 0; } @@ -250,7 +250,7 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments ?*/ - if(pThreadImpl==0 || pThreadImpl->m_hThread==0) + if(pThreadImpl==NULL || pThreadImpl->m_hThread==0) { return osl_Thread_PriorityUnknown; } @@ -307,7 +307,7 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments ?*/ - if(pThreadImpl==0 || pThreadImpl->m_hThread==0) + if(pThreadImpl==NULL || pThreadImpl->m_hThread==0) { return sal_False; } @@ -323,7 +323,7 @@ void SAL_CALL osl_joinWithThread(oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments?*/ - if(pThreadImpl==0 || pThreadImpl->m_hThread==0) + if(pThreadImpl==NULL || pThreadImpl->m_hThread==0) { /* assume thread is not running */ return; @@ -353,7 +353,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread) osl_TThreadImpl* pThreadImpl= (osl_TThreadImpl*)Thread; /* invalid arguments?*/ - if (pThreadImpl==0 || pThreadImpl->m_hThread==0) + if (pThreadImpl==NULL || pThreadImpl->m_hThread==0) { /* assume thread is not running */ return; @@ -373,7 +373,7 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) osl_yieldThread(); /* invalid arguments?*/ - if (pThreadImpl==0 || pThreadImpl->m_hThread==0) + if (pThreadImpl==NULL || pThreadImpl->m_hThread==0) { /* assume thread is not running */ return sal_False; @@ -432,7 +432,7 @@ static void AddKeyToList( PTLS pTls ) EnterCriticalSection( &g_ThreadKeyListCS ); pTls->pNext = g_pThreadKeyList; - pTls->pPrev = 0; + pTls->pPrev = NULL; if ( g_pThreadKeyList ) g_pThreadKeyList->pPrev = pTls; @@ -497,7 +497,7 @@ oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback if ( (DWORD)-1 == (pTls->dwIndex = TlsAlloc()) ) { rtl_freeMemory( pTls ); - pTls = 0; + pTls = NULL; } else AddKeyToList( pTls ); diff --git a/sal/osl/w32/time.c b/sal/osl/w32/time.c index ca0eabb..358a441 100644 --- a/sal/osl/w32/time.c +++ b/sal/osl/w32/time.c @@ -41,7 +41,7 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal) FILETIME CurTime, OffTime; __int64 Value; - OSL_ASSERT(pTimeVal != 0); + OSL_ASSERT(pTimeVal != NULL); GetSystemTime(&SystemTime); SystemTimeToFileTime(&SystemTime, &CurTime); diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c index 571926c..582ab10 100644 --- a/sal/rtl/source/alloc_arena.c +++ b/sal/rtl/source/alloc_arena.c @@ -62,7 +62,7 @@ static struct rtl_arena_list_st g_arena_list; * * @internal */ -static rtl_arena_type * gp_arena_arena = 0; +static rtl_arena_type * gp_arena_arena = NULL; /** gp_machdep_arena @@ -72,7 +72,7 @@ static rtl_arena_type * gp_arena_arena = 0; * * @internal */ -static rtl_arena_type * gp_machdep_arena = 0; +static rtl_arena_type * gp_machdep_arena = NULL; static void * @@ -94,7 +94,7 @@ rtl_machdep_pagesize (void); /** gp_default_arena */ -rtl_arena_type * gp_default_arena = 0; +rtl_arena_type * gp_default_arena = NULL; /** rtl_arena_init() @@ -150,7 +150,7 @@ rtl_arena_segment_populate ( sal_Size size = rtl_machdep_pagesize(); span = rtl_machdep_alloc(gp_machdep_arena, &size); - if (span != 0) + if (span != NULL) { rtl_arena_segment_type *first, *last, *head; sal_Size count = size / sizeof(rtl_arena_segment_type); @@ -173,7 +173,7 @@ rtl_arena_segment_populate ( first->m_type = 0; } } - return (span != 0); + return (span != NULL); } @@ -190,7 +190,7 @@ rtl_arena_segment_get ( { rtl_arena_segment_type * head; - OSL_ASSERT(*ppSegment == 0); + OSL_ASSERT(*ppSegment == NULL); head = &(arena->m_segment_reserve_head); if ((head->m_snext != head) || rtl_arena_segment_populate (arena)) @@ -232,7 +232,7 @@ rtl_arena_segment_put ( QUEUE_INSERT_HEAD_NAMED(head, (*ppSegment), s); /* clear */ - (*ppSegment) = 0; + (*ppSegment) = NULL; } #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) @@ -317,7 +317,7 @@ rtl_arena_hash_rescale ( new_bytes = new_size * sizeof(rtl_arena_segment_type*); new_table = (rtl_arena_segment_type **)rtl_arena_alloc (gp_arena_arena, &new_bytes); - if (new_table != 0) + if (new_table != NULL) { rtl_arena_segment_type ** old_table; sal_Size old_size, i; @@ -361,7 +361,7 @@ rtl_arena_hash_rescale ( for (i = 0; i < old_size; i++) { rtl_arena_segment_type * curr = old_table[i]; - while (curr != 0) + while (curr != NULL) { rtl_arena_segment_type * next = curr->m_fnext; rtl_arena_segment_type ** head; @@ -372,7 +372,7 @@ rtl_arena_hash_rescale ( curr = next; } - old_table[i] = 0; + old_table[i] = NULL; } RTL_MEMORY_LOCK_RELEASE(&(arena->m_lock)); @@ -429,7 +429,7 @@ rtl_arena_hash_remove ( #endif /* OSL_DEBUG_LEVEL */ segpp = &(arena->m_hash_table[RTL_ARENA_HASH_INDEX(arena, addr)]); - while ((segment = *segpp) != 0) + while ((segment = *segpp) != NULL) { if (segment->m_addr == addr) { @@ -442,8 +442,8 @@ rtl_arena_hash_remove ( segpp = &(segment->m_fnext); } - OSL_POSTCOND(segment != 0, "rtl_arena_hash_remove(): bad free."); - if (segment != 0) + OSL_POSTCOND(segment != NULL, "rtl_arena_hash_remove(): bad free."); + if (segment != NULL) { OSL_POSTCOND(segment->m_size == size, "rtl_arena_hash_remove(): wrong size."); @@ -490,7 +490,7 @@ rtl_arena_segment_alloc ( { int index = 0; - OSL_ASSERT(*ppSegment == 0); + OSL_ASSERT(*ppSegment == NULL); if (!RTL_MEMORY_ISP2(size)) { int msb = highbit(size); @@ -528,12 +528,12 @@ rtl_arena_segment_alloc ( } dequeue_and_leave: - if (*ppSegment != 0) + if (*ppSegment != NULL) { /* remove from freelist */ rtl_arena_freelist_remove (arena, (*ppSegment)); } - return (*ppSegment != 0); + return (*ppSegment != NULL); } @@ -550,15 +550,15 @@ rtl_arena_segment_create ( rtl_arena_segment_type ** ppSegment ) { - OSL_ASSERT((*ppSegment) == 0); + OSL_ASSERT((*ppSegment) == NULL); if (arena->m_source_alloc != 0) { rtl_arena_segment_get (arena, ppSegment); - if (*ppSegment != 0) + if (*ppSegment != NULL) { - rtl_arena_segment_type * span = 0; + rtl_arena_segment_type * span = NULL; rtl_arena_segment_get (arena, &span); - if (span != 0) + if (span != NULL) { /* import new span from source arena */ RTL_MEMORY_LOCK_RELEASE(&(arena->m_lock)); @@ -747,8 +747,8 @@ rtl_arena_activate ( void (SAL_CALL * source_free) (rtl_arena_type *, void *, sal_Size) ) { - OSL_ASSERT(arena != 0); - if (arena != 0) + OSL_ASSERT(arena != NULL); + if (arena != NULL) { (void) snprintf (arena->m_name, sizeof(arena->m_name), "%s", name); @@ -852,7 +852,7 @@ rtl_arena_deactivate ( /* cleanup still used segment(s) */ for (i = 0, n = arena->m_hash_size; i < n; i++) { - while ((segment = arena->m_hash_table[i]) != 0) + while ((segment = arena->m_hash_table[i]) != NULL) { /* pop from hash table */ arena->m_hash_table[i] = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment; @@ -998,7 +998,7 @@ SAL_CALL rtl_arena_destroy ( rtl_arena_type * arena ) { - if (arena != 0) + if (arena != NULL) { rtl_arena_deactivate (arena); rtl_arena_destructor (arena); @@ -1293,7 +1293,7 @@ rtl_arena_once_init (void) /* machdep (pseudo) arena */ static rtl_arena_type g_machdep_arena; - OSL_ASSERT(gp_machdep_arena == 0); + OSL_ASSERT(gp_machdep_arena == NULL); VALGRIND_CREATE_MEMPOOL(&g_machdep_arena, 0, 0); rtl_arena_constructor (&g_machdep_arena); @@ -1304,13 +1304,13 @@ rtl_arena_once_init (void) 0, /* no quantum caching */ 0, 0, 0 /* no source */ ); - OSL_ASSERT(gp_machdep_arena != 0); + OSL_ASSERT(gp_machdep_arena != NULL); } { /* default arena */ static rtl_arena_type g_default_arena; - OSL_ASSERT(gp_default_arena == 0); + OSL_ASSERT(gp_default_arena == NULL); VALGRIND_CREATE_MEMPOOL(&g_default_arena, 0, 0); rtl_arena_constructor (&g_default_arena); @@ -1323,13 +1323,13 @@ rtl_arena_once_init (void) rtl_machdep_alloc, rtl_machdep_free ); - OSL_ASSERT(gp_default_arena != 0); + OSL_ASSERT(gp_default_arena != NULL); } { /* arena internal arena */ static rtl_arena_type g_arena_arena; - OSL_ASSERT(gp_arena_arena == 0); + OSL_ASSERT(gp_arena_arena == NULL); VALGRIND_CREATE_MEMPOOL(&g_arena_arena, 0, 0); rtl_arena_constructor (&g_arena_arena); @@ -1342,7 +1342,7 @@ rtl_arena_once_init (void) rtl_arena_alloc, rtl_arena_free ); - OSL_ASSERT(gp_arena_arena != 0); + OSL_ASSERT(gp_arena_arena != NULL); } } @@ -1351,7 +1351,7 @@ rtl_arena_init (void) { static sal_once_type g_once = SAL_ONCE_INIT; SAL_ONCE(&g_once, rtl_arena_once_init); - return (gp_arena_arena != 0); + return (gp_arena_arena != NULL); } /* ================================================================= */ @@ -1377,7 +1377,7 @@ static void rtl_arena_fini (void); void rtl_arena_fini (void) { - if (gp_arena_arena != 0) + if (gp_arena_arena != NULL) { rtl_arena_type * arena, * head; diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c index dccbb20..7f02696 100644 --- a/sal/rtl/source/alloc_cache.c +++ b/sal/rtl/source/alloc_cache.c @@ -80,25 +80,25 @@ static struct rtl_cache_list_st g_cache_list; * * @internal */ -static rtl_arena_type * gp_cache_arena = 0; +static rtl_arena_type * gp_cache_arena = NULL; /** gp_cache_magazine_cache * @internal */ -static rtl_cache_type * gp_cache_magazine_cache = 0; +static rtl_cache_type * gp_cache_magazine_cache = NULL; /** gp_cache_slab_cache * @internal */ -static rtl_cache_type * gp_cache_slab_cache = 0; +static rtl_cache_type * gp_cache_slab_cache = NULL; /** gp_cache_bufctl_cache * @internal */ -static rtl_cache_type * gp_cache_bufctl_cache = 0; +static rtl_cache_type * gp_cache_bufctl_cache = NULL; /** rtl_cache_init() @@ -133,7 +133,7 @@ rtl_cache_hash_rescale ( new_bytes = new_size * sizeof(rtl_cache_bufctl_type*); new_table = (rtl_cache_bufctl_type**)rtl_arena_alloc(gp_cache_arena, &new_bytes); - if (new_table != 0) + if (new_table != NULL) { rtl_cache_bufctl_type ** old_table; sal_Size old_size, i; @@ -162,7 +162,7 @@ rtl_cache_hash_rescale ( for (i = 0; i < old_size; i++) { rtl_cache_bufctl_type * curr = old_table[i]; - while (curr != 0) + while (curr != NULL) { rtl_cache_bufctl_type * next = curr->m_next; rtl_cache_bufctl_type ** head; @@ -173,7 +173,7 @@ rtl_cache_hash_rescale ( curr = next; } - old_table[i] = 0; + old_table[i] = NULL; } RTL_MEMORY_LOCK_RELEASE(&(cache->m_slab_lock)); @@ -222,11 +222,11 @@ rtl_cache_hash_remove ( sal_Size lookups = 0; ppHead = &(cache->m_hash_table[RTL_CACHE_HASH_INDEX(cache, addr)]); - while ((bufctl = *ppHead) != 0) + while ((bufctl = *ppHead) != NULL) { if (bufctl->m_addr == addr) { - *ppHead = bufctl->m_next, bufctl->m_next = 0; + *ppHead = bufctl->m_next, bufctl->m_next = NULL; break; } @@ -234,7 +234,7 @@ rtl_cache_hash_remove ( ppHead = &(bufctl->m_next); } - OSL_ASSERT (bufctl != 0); /* bad free */ + OSL_ASSERT (bufctl != NULL); /* bad free */ if (lookups > 1) { @@ -312,13 +312,13 @@ rtl_cache_slab_create ( rtl_cache_type * cache ) { - rtl_cache_slab_type * slab = 0; + rtl_cache_slab_type * slab = NULL; void * addr; sal_Size size; size = cache->m_slab_size; addr = rtl_arena_alloc (cache->m_source, &size); - if (addr != 0) + if (addr != NULL) { OSL_ASSERT(size >= cache->m_slab_size); @@ -334,13 +334,13 @@ rtl_cache_slab_create ( slab = RTL_CACHE_SLAB(addr, cache->m_slab_size); (void) rtl_cache_slab_constructor (slab, 0); } - if (slab != 0) + if (slab != NULL) { slab->m_data = (sal_uIntPtr)(addr); /* dynamic freelist initialization */ slab->m_bp = slab->m_data; - slab->m_sp = 0; + slab->m_sp = NULL; } else { @@ -368,12 +368,12 @@ rtl_cache_slab_destroy ( { /* cleanup bufctl(s) for free buffer(s) */ sal_Size ntypes = (slab->m_bp - slab->m_data) / cache->m_type_size; - for (ntypes -= refcnt; slab->m_sp != 0; ntypes--) + for (ntypes -= refcnt; slab->m_sp != NULL; ntypes--) { rtl_cache_bufctl_type * bufctl = slab->m_sp; /* pop from freelist */ - slab->m_sp = bufctl->m_next, bufctl->m_next = 0; + slab->m_sp = bufctl->m_next, bufctl->m_next = NULL; /* return bufctl struct to bufctl cache */ rtl_cache_free (gp_cache_bufctl_cache, bufctl); @@ -411,7 +411,7 @@ rtl_cache_slab_populate ( RTL_MEMORY_LOCK_RELEASE(&(cache->m_slab_lock)); slab = rtl_cache_slab_create (cache); RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_slab_lock)); - if (slab != 0) + if (slab != NULL) { /* update buffer start addr w/ current color */ slab->m_bp += cache->m_ncolor; @@ -427,7 +427,7 @@ rtl_cache_slab_populate ( /* insert onto 'free' queue */ QUEUE_INSERT_HEAD_NAMED(&(cache->m_free_head), slab, slab_); } - return (slab != 0); + return (slab != NULL); } /* ================================================================= */ @@ -441,7 +441,7 @@ rtl_cache_slab_alloc ( rtl_cache_type * cache ) { - void * addr = 0; + void * addr = NULL; rtl_cache_slab_type * head; RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_slab_lock)); @@ -455,7 +455,7 @@ rtl_cache_slab_alloc ( slab = head->m_slab_next; OSL_ASSERT(slab->m_ntypes < cache->m_ntypes); - if (slab->m_sp == 0) + if (slab->m_sp == NULL) { /* initialize bufctl w/ current 'slab->m_bp' */ OSL_ASSERT (slab->m_bp < slab->m_data + cache->m_ntypes * cache->m_type_size + cache->m_ncolor_max); @@ -464,7 +464,7 @@ rtl_cache_slab_alloc ( /* allocate bufctl */ OSL_ASSERT (cache != gp_cache_bufctl_cache); bufctl = (rtl_cache_bufctl_type*)rtl_cache_alloc (gp_cache_bufctl_cache); - if (bufctl == 0) + if (bufctl == NULL) { /* out of memory */ RTL_MEMORY_LOCK_RELEASE(&(cache->m_slab_lock)); @@ -479,7 +479,7 @@ rtl_cache_slab_alloc ( /* embedded bufctl */ bufctl = (rtl_cache_bufctl_type*)(slab->m_bp); } - bufctl->m_next = 0; + bufctl->m_next = NULL; /* update 'slab->m_bp' to next free buffer */ slab->m_bp += cache->m_type_size; @@ -545,7 +545,7 @@ rtl_cache_slab_free ( if (cache->m_features & RTL_CACHE_FEATURE_HASH) { bufctl = rtl_cache_hash_remove (cache, (sal_uIntPtr)(addr)); - slab = (bufctl != 0) ? (rtl_cache_slab_type*)(bufctl->m_slab) : 0; + slab = (bufctl != NULL) ? (rtl_cache_slab_type*)(bufctl->m_slab) : 0; } else { @@ -554,7 +554,7 @@ rtl_cache_slab_free ( slab = RTL_CACHE_SLAB(addr, cache->m_slab_size); } - if (slab != 0) + if (slab != NULL) { /* check for full slab */ if (slab->m_ntypes == cache->m_ntypes) @@ -605,7 +605,7 @@ rtl_cache_magazine_constructor (void * obj, void * arg) (void) arg; /* unused */ - mag->m_mag_next = 0; + mag->m_mag_next = NULL; mag->m_mag_size = RTL_CACHE_MAGAZINE_SIZE; mag->m_mag_used = 0; @@ -624,7 +624,7 @@ rtl_cache_magazine_destructor (void * obj, void * arg) rtl_cache_magazine_type * mag = (rtl_cache_magazine_type*)(obj); /* assure removed from queue(s) */ - OSL_ASSERT(mag->m_mag_next == 0); + OSL_ASSERT(mag->m_mag_next == NULL); /* assure no longer referenced */ OSL_ASSERT(mag->m_mag_used == 0); @@ -645,7 +645,7 @@ rtl_cache_magazine_clear ( for (; mag->m_mag_used > 0; --mag->m_mag_used) { void * obj = mag->m_objects[mag->m_mag_used - 1]; - mag->m_objects[mag->m_mag_used - 1] = 0; + mag->m_objects[mag->m_mag_used - 1] = NULL; /* DEBUG ONLY: mark cached object allocated, undefined */ VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); @@ -697,15 +697,15 @@ rtl_cache_depot_dequeue ( rtl_cache_depot_type * depot ) { - rtl_cache_magazine_type * mag = 0; + rtl_cache_magazine_type * mag = NULL; if (depot->m_mag_count > 0) { /* dequeue magazine */ - OSL_ASSERT(depot->m_mag_next != 0); + OSL_ASSERT(depot->m_mag_next != NULL); mag = depot->m_mag_next; depot->m_mag_next = mag->m_mag_next; - mag->m_mag_next = 0; + mag->m_mag_next = NULL; /* update depot stats */ depot->m_mag_count--; @@ -731,17 +731,17 @@ rtl_cache_depot_exchange_alloc ( { rtl_cache_magazine_type * full; - OSL_ASSERT((empty == 0) || (empty->m_mag_used == 0)); + OSL_ASSERT((empty == NULL) || (empty->m_mag_used == 0)); /* dequeue full magazine */ full = rtl_cache_depot_dequeue (&(cache->m_depot_full)); - if ((full != 0) && (empty != 0)) + if ((full != NULL) && (empty != NULL)) { /* enqueue empty magazine */ rtl_cache_depot_enqueue (&(cache->m_depot_empty), empty); } - OSL_ASSERT((full == 0) || (full->m_mag_used > 0)); + OSL_ASSERT((full == NULL) || (full->m_mag_used > 0)); return (full); } @@ -763,17 +763,17 @@ rtl_cache_depot_exchange_free ( { rtl_cache_magazine_type * empty; - OSL_ASSERT((full == 0) || (full->m_mag_used > 0)); + OSL_ASSERT((full == NULL) || (full->m_mag_used > 0)); /* dequeue empty magazine */ empty = rtl_cache_depot_dequeue (&(cache->m_depot_empty)); - if ((empty != 0) && (full != 0)) + if ((empty != NULL) && (full != NULL)) { /* enqueue full magazine */ rtl_cache_depot_enqueue (&(cache->m_depot_full), full); } - OSL_ASSERT((empty == 0) || (empty->m_mag_used == 0)); + OSL_ASSERT((empty == NULL) || (empty->m_mag_used == 0)); return (empty); } @@ -792,7 +792,7 @@ rtl_cache_depot_populate ( rtl_cache_type * cache ) { - rtl_cache_magazine_type * empty = 0; + rtl_cache_magazine_type * empty = NULL; if (cache->m_magazine_cache != 0) { @@ -800,13 +800,13 @@ rtl_cache_depot_populate ( RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); empty = (rtl_cache_magazine_type*)rtl_cache_alloc (cache->m_magazine_cache); RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock)); - if (empty != 0) + if (empty != NULL) { /* enqueue (new) empty magazine */ rtl_cache_depot_enqueue (&(cache->m_depot_empty), empty); } } - return (empty != 0); + return (empty != NULL); } /* ================================================================= */ @@ -881,8 +881,8 @@ rtl_cache_activate ( int flags ) { - OSL_ASSERT(cache != 0); - if (cache != 0) + OSL_ASSERT(cache != NULL); + if (cache != NULL) { sal_Size slabsize; @@ -937,8 +937,8 @@ rtl_cache_activate ( if (cache->m_slab_size > source->m_quantum) { - OSL_ASSERT(gp_cache_slab_cache != 0); - OSL_ASSERT(gp_cache_bufctl_cache != 0); + OSL_ASSERT(gp_cache_slab_cache != NULL); + OSL_ASSERT(gp_cache_bufctl_cache != NULL); cache->m_features |= RTL_CACHE_FEATURE_HASH; cache->m_ntypes = cache->m_slab_size / cache->m_type_size; @@ -963,7 +963,7 @@ rtl_cache_activate ( /* magazine layer */ if (!(flags & RTL_CACHE_FLAG_NOMAGAZINE)) { - OSL_ASSERT(gp_cache_magazine_cache != 0); + OSL_ASSERT(gp_cache_magazine_cache != NULL); cache->m_magazine_cache = gp_cache_magazine_cache; } @@ -1002,13 +1002,13 @@ rtl_cache_deactivate ( mag_cache = cache->m_magazine_cache, cache->m_magazine_cache = 0; /* cleanup cpu layer */ - if ((mag = cache->m_cpu_curr) != 0) + if ((mag = cache->m_cpu_curr) != NULL) { cache->m_cpu_curr = 0; rtl_cache_magazine_clear (cache, mag); rtl_cache_free (mag_cache, mag); } - if ((mag = cache->m_cpu_prev) != 0) + if ((mag = cache->m_cpu_prev) != NULL) { cache->m_cpu_prev = 0; rtl_cache_magazine_clear (cache, mag); @@ -1016,12 +1016,12 @@ rtl_cache_deactivate ( } /* cleanup depot layer */ - while ((mag = rtl_cache_depot_dequeue(&(cache->m_depot_full))) != 0) + while ((mag = rtl_cache_depot_dequeue(&(cache->m_depot_full))) != NULL) { rtl_cache_magazine_clear (cache, mag); rtl_cache_free (mag_cache, mag); } - while ((mag = rtl_cache_depot_dequeue(&(cache->m_depot_empty))) != 0) + while ((mag = rtl_cache_depot_dequeue(&(cache->m_depot_empty))) != NULL) { rtl_cache_magazine_clear (cache, mag); rtl_cache_free (mag_cache, mag); @@ -1059,10 +1059,10 @@ rtl_cache_deactivate ( for (i = 0; i < n; i++) { rtl_cache_bufctl_type * bufctl; - while ((bufctl = cache->m_hash_table[i]) != 0) + while ((bufctl = cache->m_hash_table[i]) != NULL) { /* pop from hash table */ - cache->m_hash_table[i] = bufctl->m_next, bufctl->m_next = 0; + cache->m_hash_table[i] = bufctl->m_next, bufctl->m_next = NULL; /* return to bufctl cache */ rtl_cache_free (gp_cache_bufctl_cache, bufctl); @@ -1559,7 +1559,7 @@ rtl_cache_depot_wsupdate ( for (; npurge > 0; npurge--) { rtl_cache_magazine_type * mag = rtl_cache_depot_dequeue (depot); - if (mag != 0) + if (mag != NULL) { RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); rtl_cache_magazine_clear (cache, mag); @@ -1656,7 +1656,7 @@ rtl_cache_once_init (void) } { /* cache: internal arena */ - OSL_ASSERT(gp_cache_arena == 0); + OSL_ASSERT(gp_cache_arena == NULL); gp_cache_arena = rtl_arena_create ( "rtl_cache_internal_arena", @@ -1667,16 +1667,16 @@ rtl_cache_once_init (void) rtl_arena_free, 0 /* flags */ ); - OSL_ASSERT(gp_cache_arena != 0); + OSL_ASSERT(gp_cache_arena != NULL); /* check 'gp_default_arena' initialization */ - OSL_ASSERT(gp_default_arena != 0); + OSL_ASSERT(gp_default_arena != NULL); } { /* cache: magazine cache */ static rtl_cache_type g_cache_magazine_cache; - OSL_ASSERT(gp_cache_magazine_cache == 0); + OSL_ASSERT(gp_cache_magazine_cache == NULL); VALGRIND_CREATE_MEMPOOL(&g_cache_magazine_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_magazine_cache); @@ -1692,7 +1692,7 @@ rtl_cache_once_init (void) gp_default_arena, /* source */ RTL_CACHE_FLAG_NOMAGAZINE /* during bootstrap; activated below */ ); - OSL_ASSERT(gp_cache_magazine_cache != 0); + OSL_ASSERT(gp_cache_magazine_cache != NULL); /* activate magazine layer */ g_cache_magazine_cache.m_magazine_cache = gp_cache_magazine_cache; @@ -1701,7 +1701,7 @@ rtl_cache_once_init (void) /* cache: slab (struct) cache */ static rtl_cache_type g_cache_slab_cache; - OSL_ASSERT(gp_cache_slab_cache == 0); + OSL_ASSERT(gp_cache_slab_cache == NULL); VALGRIND_CREATE_MEMPOOL(&g_cache_slab_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_slab_cache); @@ -1717,13 +1717,13 @@ rtl_cache_once_init (void) gp_default_arena, /* source */ 0 /* flags: none */ ); - OSL_ASSERT(gp_cache_slab_cache != 0); + OSL_ASSERT(gp_cache_slab_cache != NULL); } { /* cache: bufctl cache */ static rtl_cache_type g_cache_bufctl_cache; - OSL_ASSERT(gp_cache_bufctl_cache == 0); + OSL_ASSERT(gp_cache_bufctl_cache == NULL); VALGRIND_CREATE_MEMPOOL(&g_cache_bufctl_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_bufctl_cache); @@ -1739,7 +1739,7 @@ rtl_cache_once_init (void) gp_default_arena, /* source */ 0 /* flags: none */ ); - OSL_ASSERT(gp_cache_bufctl_cache != 0); + OSL_ASSERT(gp_cache_bufctl_cache != NULL); } rtl_cache_wsupdate_init(); @@ -1750,7 +1750,7 @@ rtl_cache_init (void) { static sal_once_type g_once = SAL_ONCE_INIT; SAL_ONCE(&g_once, rtl_cache_once_init); - return (gp_cache_arena != 0); + return (gp_cache_arena != NULL); } /* ================================================================= */ @@ -1776,37 +1776,37 @@ static void rtl_cache_fini (void); void rtl_cache_fini (void) { - if (gp_cache_arena != 0) + if (gp_cache_arena != NULL) { rtl_cache_type * cache, * head; rtl_cache_wsupdate_fini(); - if (gp_cache_bufctl_cache != 0) + if (gp_cache_bufctl_cache != NULL) { - cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = 0; + cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = NULL; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); VALGRIND_DESTROY_MEMPOOL(cache); } - if (gp_cache_slab_cache != 0) + if (gp_cache_slab_cache != NULL) { - cache = gp_cache_slab_cache, gp_cache_slab_cache = 0; + cache = gp_cache_slab_cache, gp_cache_slab_cache = NULL; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); VALGRIND_DESTROY_MEMPOOL(cache); } - if (gp_cache_magazine_cache != 0) + if (gp_cache_magazine_cache != NULL) { - cache = gp_cache_magazine_cache, gp_cache_magazine_cache = 0; + cache = gp_cache_magazine_cache, gp_cache_magazine_cache = NULL; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); VALGRIND_DESTROY_MEMPOOL(cache); } - if (gp_cache_arena != 0) + if (gp_cache_arena != NULL) { rtl_arena_destroy (gp_cache_arena); - gp_cache_arena = 0; + gp_cache_arena = NULL; } RTL_MEMORY_LOCK_ACQUIRE(&(g_cache_list.m_lock)); diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c index a6f186d..f8c7128 100644 --- a/sal/rtl/source/alloc_global.c +++ b/sal/rtl/source/alloc_global.c @@ -83,7 +83,7 @@ static rtl_cache_type * g_alloc_table[RTL_MEMORY_CACHED_LIMIT >> RTL_MEMALIGN_SH 0, }; -static rtl_arena_type * gp_alloc_arena = 0; +static rtl_arena_type * gp_alloc_arena = NULL; /* ================================================================= * * @@ -96,7 +96,7 @@ rtl_memory_once_init (void) { { /* global memory arena */ - OSL_ASSERT(gp_alloc_arena == 0); + OSL_ASSERT(gp_alloc_arena == NULL); gp_alloc_arena = rtl_arena_create ( "rtl_alloc_arena", @@ -107,7 +107,7 @@ rtl_memory_once_init (void) rtl_arena_free, 0 /* flags */ ); - OSL_ASSERT(gp_alloc_arena != 0); + OSL_ASSERT(gp_alloc_arena != NULL); } { sal_Size size; @@ -137,7 +137,7 @@ rtl_memory_init (void) { static sal_once_type g_once = SAL_ONCE_INIT; SAL_ONCE(&g_once, rtl_memory_once_init); - return (gp_alloc_arena != 0); + return (gp_alloc_arena != NULL); } /* ================================================================= */ @@ -171,18 +171,18 @@ rtl_memory_fini (void) /* cleanup g_alloc_caches */ for (i = 0, n = RTL_MEMORY_CACHED_SIZES; i < n; i++) { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits