summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix Clang warning about memcpy a class with vtablesThiago Macieira2012-12-231-1/+1
| | | | | Change-Id: I7966014a49cdf4c6c82f012d8b1d16ba8ddc3fcc Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove use of ::free from qlist.hThiago Macieira2012-08-091-5/+7
| | | | | | | | | | | | | | | | | The memory is allocated in qlist.cpp, so it should be freed in qlist.cpp. Freeing it in qlist.cpp ties our hands about future improvements to the allocator. In addition, silence the warning by the too-smart-for-its-own-good GCC that we're trying to free a non-heap object: qlist.h:763:14: warning: attempt to free a non-heap object "QListData::shared_null" [-Wfree-nonheap-object] The warning is wrong. It should say "possibly" somewhere because GCC failed to account for all conditions in the path to free(). Change-Id: I34a6c16bba9a2197fc83eb3c7a63ae06fb25bf15 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Implement the move constructor for containers.Olivier Goffart2012-05-111-1/+2
| | | | | | | | | | | | | | | This changes all the containers that uses QtPrivate::RefCount (QMap already had one), and QVariant In Qt 4.8, it was pointless to have the move constructor because we did not have quick way to re-initialize a null container. (shared_null still needed to be refcounted) But now that we have RefCount, and that the shared_null do not have reference count, we can implement a fast move constructor that do not generate code to increment the reference count. Change-Id: I2bc3c6ae96983f08aa7b1c7cb98d44a89255160b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove references to QT_NO_STL from QtCoreThiago Macieira2012-04-071-5/+0
| | | | | | | | QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove all calls to, and deprecate qMalloc, qRealloc and qFree.Robin Burchell2012-03-311-5/+6
| | | | | | | | | | | | | | | | | | Callers should just call the standard allocation functions directly. Adding an extra function call onto all basic memory management for the sake of making it instrumentable in rare cases isn't really fair to everyone else. What's more, this wasn't completely reliable, as not everything was using them in a number of places. Memory management can still be overridden using tricks like LD_PRELOAD if needed. Their aligned equivilents cannot be deprecated, as no standard equivilents exist, although investigation into posix_memalign(3) is a possibility for the future. Change-Id: Ic5f74b14be33f8bc188fe7236c55e15c36a23fc7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge master into api_changesKent Hansen2012-03-191-0/+2
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
| * containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()Marc Mutz2012-03-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365. Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Base QList::setSharable on RefCount::setSharableJoão Abecasis2012-03-051-3/+32
| | | | | | | | | | Change-Id: I2acccdf9ee595a0eee33c9f7ddded9cc121412c1 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* | QList: have operator= defer to copy-ctor and swapJoão Abecasis2012-02-291-7/+2
| | | | | | | | | | Change-Id: I0f9bdbc444abfaea35278281b6c1dff4b52c526f Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-291-1/+1
|\| | | | | | | Change-Id: I97ba222435ff50a9e5422e6f2c73e4bb8d1b865c
| * Silence coverity warning about sizeof(Node*) vs sizeof(Node) in QListAndy Shaw2012-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity was complaining about QList::node_copy using sizeof(Node *) instead of sizeof(Node). The complete message from Coverity is: "Passing argument "from" of type "struct QList<QObject *>::Node *" and argument "(to - from) * sizeof (struct QList<QObject *>::Node *) /*4*/" to function "memcpy" is suspicious. Did you intend to use "sizeof(struct QList<QObject *>::Node)" instead of "sizeof (struct QList<QObject *>::Node *)" ? In this particular case sizeof(struct QList<QObject *>::Node *) happens to be equal to sizeof(struct QList<QObject *>::Node), but this is not a portable assumption." Task-number: QTBUG-24443 Change-Id: I583887a8b4177a224664065e14f8780a9586c9a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-051-7/+6
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
| * Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | | | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * Remove QBool and use bool instead.David Faure2012-01-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | QBool was introduced with Qt-4.0, to detect Qt3-like code like if (c.contains(d) == 2) and break compilation on such constructs. This isn't necessary anymore, given that such code couldn't possibly compile in Qt4 times. And QBool was confusing developers, and creating compile errors (e.g. QVariant doesn't have support for it), so better remove it for Qt 5. Change-Id: I6642f43f5e12b872f98abb56600186179f072b09 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Don't use RefCount int operatorsJoão Abecasis2012-01-231-8/+8
|/ | | | | | | | | | | | | , as those are going away. The comment in QString/QByteArray::squeeze about shared_null was updated as it also affects other static data, such as that generated by QStringLiteral and QByteArrayLiteral. Change-Id: I26a757d29db62b1e3566a1f7c8d4030918ed8a89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't crash by modifying read-only shared_nullBradley T. Hughes2011-10-041-1/+1
| | | | | | | | | | | | | | | | | | | Functions that modify the d-pointer must detach or otherwise take measures to not modify the const, read-only shared_null. The setSharable(bool) function takes care to detach when setting sharable to false, but should avoid setting the sharable data member unless d is not the shared null. Similarly, QMap<Key, T>::setInsertInOrder() needs to detach if it is shared with the shared_null (the logic has been updated to be the same as setSharable()). Change-Id: Ida5cb9818b86695f1b9f0264418b955c56424898 Reviewed-on: http://codereview.qt-project.org/5929 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
* Make QListData::shared_null constBradley T. Hughes2011-09-261-7/+8
| | | | | | | | | | Similar to QMap, QVector, QByteArray and QString, keep the shared_null in shareable memory and never modify it. Change-Id: I2b4bb8de564080021043f6ede6c903d567c686cf Reviewed-on: http://codereview.qt-project.org/4531 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* don't detach until the list is going to be modifiedRitt Konstantin2011-09-121-1/+0
| | | | | | | | | | | | | | removeAt() does detach()'ing for us Merge-request: 1285 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit 52223d80ec8ba6d579c091efe0e40589a5d2bd67) Change-Id: I78865e19f989d9079c8dee47b8cf1bdf7e5db261 Reviewed-on: http://codereview.qt-project.org/4578 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* optimize QList::removeAll()Ritt Konstantin2011-09-121-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a) don't detach until an occurrence found b) don't memmove every time an occurrence found c) truncate quickly ) well, numbers are better than words: before: RESULT : tst_QList::removeAll_primitive(): 2,617,902 CPU ticks per iteration (total: 261,790,171, iterations: 100) RESULT : tst_QList::removeAll_movable(): 2,547,540 CPU ticks per iteration (total: 254,753,960, iterations: 100) RESULT : tst_QList::removeAll_complex(): 16,852,099 CPU ticks per iteration (total: 1,685,209,906, iterations: 100) after: RESULT : tst_QList::removeAll_primitive(): 73,520 CPU ticks per iteration (total: 73,520,442, iterations: 1000) RESULT : tst_QList::removeAll_movable(): 90,422 CPU ticks per iteration (total: 90,422,464, iterations: 1000) RESULT : tst_QList::removeAll_complex(): 9,667,073 CPU ticks per iteration (total: 9,667,072,670, iterations: 1000) Merge-request: 1285 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit b209fe3b1a51f64541067917e96de99f14ad65f3) Change-Id: Ia26036ed741cefcf4b5868b7b2fc5eae8130d3dc Reviewed-on: http://codereview.qt-project.org/4577 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Rename the private helper function QList::free() to QList::dealloc()Bradley T. Hughes2011-09-011-7/+6
| | | | | | | | | | As the comment suggests, renaming this function avoids confusion with libc's free(). Change-Id: Ia077b92c947d81ef9d78de940a1cd8ed022edb3c Reviewed-on: http://codereview.qt.nokia.com/4063 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove declarations for QListData functions removed by 36c29abBradley T. Hughes2011-09-011-5/+1
| | | | | | | | | | | | | This commit removed the function implementations, but not the declarations. This removes QListData::append2(T) but moves the optimized QListData::append2(T) implementation to QListData::append(T) Change-Id: I39b6dea31420a7cefe079b94a91a96eb16000d2a Reviewed-on: http://codereview.qt.nokia.com/4062 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* remove QT3_SUPPORT from corelib/toolsLars Knoll2011-06-291-14/+0
| | | | | | | Change-Id: Ie224cf992be675c7d405d4be05e4acd4157e590e Reviewed-on: http://codereview.qt.nokia.com/863 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Fix a regression in QList::mid()Liang Qi2011-05-271-0/+2
| | | | | | | | | | | | It doesn't need to copy anything when pos is after size(). Task-number: QTBUG-19164 Reviewed-by: Oswald Buddenhagen (cherry picked from commit 8befc4982a32752e48c82cacbed045e7336a3569) Change-Id: Iccac75842616f0d41e457e844a15d1a3ccfeb642 Reviewed-on: http://codereview.qt.nokia.com/164 Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+900
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12