From 1d7fa993e096effb08f0f67510f096a9c8765b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 25 Mar 2011 16:41:52 +0100 Subject: Remove duplication with QCoreApplication::applicationId The duplication was there to allow qmake and other tools to compile without a full build of QtCore. Cleaning up this code justifies losing the benefit of PID-tagged temporary files in those tools. Reviewed-by: Olivier Goffart Reviewed-by: Robin Burchell --- src/corelib/io/qtemporaryfile.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 939ea34..fe94964 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -61,12 +61,8 @@ # include "private/qcore_unix_p.h" // overrides QT_OPEN #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -# include -#endif - -#if defined(Q_OS_VXWORKS) -# include +#if defined(QT_BUILD_CORE_LIB) +#include "qcoreapplication.h" #endif QT_BEGIN_NAMESPACE @@ -115,23 +111,13 @@ static int _gettemp(char *path, int slen) // Initialize placeholder with random chars + PID. { -#if defined(Q_OS_WIN) - int pid; -#else - pid_t pid; -#endif - -#if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 - pid = _getpid(); -#elif defined(Q_OS_VXWORKS) - pid = (pid_t) taskIdCurrent; -#else - pid = getpid(); -#endif +#if defined(QT_BUILD_CORE_LIB) + qint64 pid = QCoreApplication::applicationPid(); while (trv >= path && *trv == 'X' && pid != 0) { *trv-- = (pid % 10) + '0'; pid /= 10; } +#endif while (trv >= path && *trv == 'X') { char c; -- cgit v0.12