summaryrefslogtreecommitdiff
path: root/qmake/tools/qgvector.cpp
Unidiff
Diffstat (limited to 'qmake/tools/qgvector.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/tools/qgvector.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/qmake/tools/qgvector.cpp b/qmake/tools/qgvector.cpp
index 1985f03..3c903ed 100644
--- a/qmake/tools/qgvector.cpp
+++ b/qmake/tools/qgvector.cpp
@@ -26,24 +26,30 @@
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include "qglobal.h"
39#if defined(Q_CC_BOR)
40// needed for qsort() because of a std namespace problem on Borland
41#include "qplatformdefs.h"
42#endif
43
38 #define QGVECTOR_CPP 44 #define QGVECTOR_CPP
39#include "qgvector.h" 45#include "qgvector.h"
40#include "qglist.h" 46#include "qglist.h"
41#include "qstring.h" 47#include "qstring.h"
42#include "qdatastream.h" 48#include "qdatastream.h"
43#include <stdlib.h> 49#include <stdlib.h>
44 50
45#ifdef QT_THREAD_SUPPORT 51#ifdef QT_THREAD_SUPPORT
46# include <private/qmutexpool_p.h> 52# include <private/qmutexpool_p.h>
47#endif // QT_THREAD_SUPPORT 53#endif // QT_THREAD_SUPPORT
48 54
49 #define USE_MALLOC // comment to use new/delete 55 #define USE_MALLOC // comment to use new/delete
@@ -384,25 +390,26 @@ void QGVector::sort() // sort vector
384 while ( end > start && *end == 0 ) 390 while ( end > start && *end == 0 )
385 end--; 391 end--;
386 if ( start < end ) { 392 if ( start < end ) {
387 tmp = *start; 393 tmp = *start;
388 *start = *end; 394 *start = *end;
389 *end = tmp; 395 *end = tmp;
390 } else { 396 } else {
391 break; 397 break;
392 } 398 }
393 } 399 }
394 400
395#ifdef QT_THREAD_SUPPORT 401#ifdef QT_THREAD_SUPPORT
396 QMutexLocker locker( qt_global_mutexpool->get( &sort_vec ) ); 402 QMutexLocker locker( qt_global_mutexpool ?
403 qt_global_mutexpool->get( &sort_vec ) : 0 );
397#endif // QT_THREAD_SUPPORT 404#endif // QT_THREAD_SUPPORT
398 405
399 sort_vec = (QGVector*)this; 406 sort_vec = (QGVector*)this;
400 qsort( vec, count(), sizeof(Item), cmp_vec ); 407 qsort( vec, count(), sizeof(Item), cmp_vec );
401 sort_vec = 0; 408 sort_vec = 0;
402} 409}
403 410
404 int QGVector::bsearch( Item d ) const // binary search; when sorted 411 int QGVector::bsearch( Item d ) const // binary search; when sorted
405{ 412{
406 if ( !len ) 413 if ( !len )
407 return -1; 414 return -1;
408 if ( !d ) { 415 if ( !d ) {