diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2011-03-25 15:41:52 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2011-04-04 11:22:50 (GMT) |
commit | 1d7fa993e096effb08f0f67510f096a9c8765b1d (patch) | |
tree | 77692c69247a39c62affdb12c6cd5f29b85c2149 /src/corelib/io | |
parent | 8f5dbf0ace53daf0b2b4d48f2c5151000f0d5720 (diff) | |
download | Qt-1d7fa993e096effb08f0f67510f096a9c8765b1d.zip Qt-1d7fa993e096effb08f0f67510f096a9c8765b1d.tar.gz Qt-1d7fa993e096effb08f0f67510f096a9c8765b1d.tar.bz2 |
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
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qtemporaryfile.cpp | 24 |
1 files 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 <process.h> -#endif - -#if defined(Q_OS_VXWORKS) -# include <taskLib.h> +#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; |