summaryrefslogtreecommitdiffstats
path: root/src/tools/qstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qstring.cpp')
-rw-r--r--src/tools/qstring.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp
index 2610a2cd6..10f0a6d26 100644
--- a/src/tools/qstring.cpp
+++ b/src/tools/qstring.cpp
@@ -46,9 +46,9 @@
#endif
// WARNING
-// When MAKE_TQSTRING_THREAD_SAFE is defined, overall TQt3 performance suffers badly!
+// When MAKE_QSTRING_THREAD_SAFE is defined, overall TQt3 performance suffers badly!
// TQString is thread unsafe in many other areas; perhaps this option is not even useful?
-// #define MAKE_TQSTRING_THREAD_SAFE 1
+// #define MAKE_QSTRING_THREAD_SAFE 1
#include "ntqstring.h"
#include "ntqregexp.h"
@@ -93,9 +93,9 @@
#define ULLONG_MAX TQ_UINT64_C(18446744073709551615)
#endif
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
#include "ntqmutex.h"
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
extern TQMutex *tqt_sharedStringMutex;
@@ -1053,9 +1053,9 @@ TQStringData::TQStringData() : TQShared(),
maxl(0),
islatin1(FALSE),
security_unpaged(FALSE) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
mutex = new TQMutex(FALSE);
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
ref();
}
@@ -1067,9 +1067,9 @@ TQStringData::TQStringData(TQChar *u, uint l, uint m) : TQShared(),
maxl(m),
islatin1(FALSE),
security_unpaged(FALSE) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
mutex = new TQMutex(FALSE);
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
TQStringData::~TQStringData() {
@@ -1084,12 +1084,12 @@ TQStringData::~TQStringData() {
if ( ascii ) {
delete[] ascii;
}
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
if ( mutex ) {
delete mutex;
mutex = NULL;
}
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
void TQStringData::setDirty() {
@@ -1457,14 +1457,14 @@ QT_STATIC_CONST_IMPL TQChar TQChar::nbsp((ushort)0x00a0);
TQStringData* TQString::makeSharedNull()
{
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
if (tqt_sharedStringMutex) tqt_sharedStringMutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if (TQString::shared_null) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
return TQString::shared_null;
}
@@ -1474,9 +1474,9 @@ TQStringData* TQString::makeSharedNull()
that->d = TQString::shared_null;
#endif
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
return TQString::shared_null;
}
@@ -1517,13 +1517,13 @@ TQString::TQString( const TQString &s ) :
d(s.d)
{
if ( d && (d != shared_null) ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
d->ref();
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
}
@@ -1676,20 +1676,20 @@ TQString::~TQString()
return;
}
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->deref() ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
d->deleteSelf();
d = NULL;
}
else {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
}
@@ -1711,22 +1711,22 @@ void TQString::real_detach()
void TQString::deref()
{
if ( d && (d != shared_null) ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->deref() ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d != shared_null ) {
delete d;
}
d = 0;
}
else {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
}
}
@@ -1769,13 +1769,13 @@ void TQStringData::deleteSelf()
TQString &TQString::operator=( const TQString &s )
{
if ( s.d && (s.d != shared_null) ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
s.d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
s.d->ref();
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
s.d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
deref();
d = s.d;
@@ -1883,9 +1883,9 @@ void TQString::truncate( uint newLen )
*/
void TQString::setLength( uint newLen )
{
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->count != 1 || newLen > d->maxl ||
( newLen * 4 < d->maxl && d->maxl > 4 ) ) {
@@ -1896,24 +1896,24 @@ void TQString::setLength( uint newLen )
uint len = TQMIN( d->len, newLen );
memcpy( nd, d->unicode, sizeof(TQChar) * len );
bool unpaged = d->security_unpaged;
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
deref();
d = new TQStringData( nd, newLen, newMax );
setSecurityUnPaged(unpaged);
}
else {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
}
else {
d->len = newLen;
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
d->setDirty();
}
}
@@ -1999,21 +1999,21 @@ void TQString::squeeze()
*/
void TQString::grow( uint newLen )
{
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->count != 1 || newLen > d->maxl ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
setLength( newLen );
}
else {
d->len = newLen;
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
d->setDirty();
}
}
@@ -6423,19 +6423,19 @@ TQString TQString::fromUcs2( const unsigned short *str )
*/
TQChar& TQString::ref(uint i) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( (d->count != 1) || (i >= d->len) ) {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
subat( i );
}
else {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
d->setDirty();
return d->unicode[i];
@@ -6523,9 +6523,9 @@ TQString& TQString::setUnicode( const TQChar *unicode, uint len )
}
}
else {
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->count != 1 || len > d->maxl || ( len * 4 < d->maxl && d->maxl > 4 ) ) {
// detach, grown or shrink
uint newMax = computeNewMax( len );
@@ -6533,17 +6533,17 @@ TQString& TQString::setUnicode( const TQChar *unicode, uint len )
if ( unicode ) {
memcpy( nd, unicode, sizeof(TQChar)*len );
}
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
deref();
d = new TQStringData( nd, len, newMax );
}
else {
d->len = len;
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
d->setDirty();
if ( unicode ) {
memcpy( d->unicode, unicode, sizeof(TQChar)*len );
@@ -7254,9 +7254,9 @@ TQConstString::TQConstString( const TQChar* unicode, uint length ) :
*/
TQConstString::~TQConstString()
{
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->lock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
if ( d->count > 1 ) {
TQChar* cp = QT_ALLOC_QCHAR_VEC( d->len );
@@ -7268,9 +7268,9 @@ TQConstString::~TQConstString()
}
// The original d->unicode is now unlinked.
-#if defined(QT_THREAD_SUPPORT) && defined(MAKE_TQSTRING_THREAD_SAFE)
+#if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT && MAKE_TQSTRING_THREAD_SAFE
+#endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
}
/*!