summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix a regression in QList::mid()Liang Qi2011-05-161-0/+2
| | | | | | | It doesn't need to copy anything when pos is after size(). Task-number: QTBUG-19164 Reviewed-by: Oswald Buddenhagen
* Update licenseheader text in source filesJyri Tahtela2011-05-131-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | Reviewed-by: Trust Me
* Fix assignment of a container included in the container itselfOlivier Goffart2010-08-231-2/+3
| | | | | Task-number: QTBUG-13079 Reviewed-by: Joao
* Don't use QList's begin() and end() where possible.Robin Burchell2010-04-261-2/+2
| | | | | | | This avoids an unnecessary iterator creation, which can speed up some cases. Merge-request: 2371 Reviewed-by: Andreas Kling <andreas.kling@nokia.com>
* different approach to fixing "the other" aliasing issueOswald Buddenhagen2010-03-151-37/+15
| | | | | | | instead of copying the original value and constructing a Node later, construct a Node immediately and copy it later. Reviewed-by: thiago
* fix aliasing issue in node_construct()Oswald Buddenhagen2010-03-151-0/+8
| | | | | | | | | | invisible so far, but the next patch uncovers it. this could be possibly optimized for more compilers. however, i found no way to ask msvc whether it is doing an optimized build. Reviewed-by: thiago
* detach in fewer cases, remove redundant calculationOswald Buddenhagen2010-03-151-3/+1
| | | | Reviewed-by: thiago
* optimize appending of (empty) lists to (empty) listsOswald Buddenhagen2010-02-251-9/+16
| | | | | | | | if appending an empty lists, don't do anything. if appending to an empty list, just assign. this saves some needless detaches/reallocs. Reviewed-by: joao
* suppress pointer aliasing warningsOswald Buddenhagen2010-02-241-3/+6
| | | | | | | the code as such is safe, as no aliasing can occur here. so it is just a matter of making the compiler shut up. Reviewed-by: Olivier Goffart
* avoid double reallocations in inserting operationsOswald Buddenhagen2010-02-221-35/+96
| | | | | | | | | | | | operator+=() and co. would first detach, and then realloc if they found the reservation too small. in particular, appending anything to an empty list would trigger this double reallocation (first copy shared_null, then grow the copy). entirely rewritten take 3, this time without memory corruption or exhaustion ... :) Reviewed-by: joao
* create temporaries more intelligentlyOswald Buddenhagen2010-02-221-6/+28
| | | | | | | | | | | | | | | we already know that we are dealing with a movable type, so it is safe to keep a temporary copy of the raw data instead of going through the copy c'tor. this way we save a pretty useless ref()/deref() pair for each and every insertion of an implicitly shared type into a QList. the QtPodForSize class is somewhat ugly. we should use QIntegerForSize, but that's not possible without having separate template specializations, which is not possible without some bigger changes to the qt type info system. it will be beautified in due time. :) Reviewed-by: joao
* do not protect against self-assignment in QList::replace()Oswald Buddenhagen2010-02-221-6/+1
| | | | | | it's not the task of the container class to do so. Reviewed-by: joao
* make queues to which only lists are appended not blow the memoryOswald Buddenhagen2010-02-221-0/+1
| | | | | | | | append2(list) didn't use the array shifting logic the append() for single elements does. this would cause the list to grow endlessly despite leading elements being removed if only lists were ever appended. Reviewed-by: joao
* Merge remote branch 'origin/master' into qt-master-from-4.6Thiago Macieira2010-02-201-6/+35
|\ | | | | | | | | | | | | Conflicts: configure.exe src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp
| * Revert optimizations to QString::appendKai Koehne2010-02-181-24/+4
| | | | | | | | | | | | This reverts commit 03ac778172b783d26bb1c7c5d92bdedd045fcc92 and commit 02135be18f3c4b1d1525aff6dfe96c9c8521084d. They broke qt on all platforms (e.g. qmake didn't compile on Windows any more).
| * unbreak QList::append() and co. againOswald Buddenhagen2010-02-171-1/+1
| | | | | | | | | | | | | | | | make sure that the detached object is always at least as big as the original one. that may be somewhat wasteful, but it is no worse than before the detach() optimization. one may consider improvements later. Reviewed-by: joao
| * avoid double reallocations in appending operationsOswald Buddenhagen2010-02-161-4/+24
| | | | | | | | | | | | | | | | | | | | operator+=() and co. would first detach, and then realloc if they found the reservation too small. in particular, appending anything to an empty list would trigger this double reallocation (first copy shared_null, then grow the copy). Reviewed-by: joao Reviewed-by: denis
| * optimize QList::mid()Oswald Buddenhagen2010-02-161-3/+12
| | | | | | | | | | | | | | | | | | instead of append()ing each element separately, reserve enough space and do a low-level node copy. obviously, the gain for small simple types is the biggest. Reviewed-by: joao Reviewed-by: denis
| * add QList::reserve()Oswald Buddenhagen2010-02-161-3/+23
| | | | | | | | | | | | | | | | | | while this reserves memory "only" for the pointer list, this still amounts to 100% of the re-allocs for small simple types. for big/complex/static types the gain is lower, but still. Reviewed-by: Denis Reviewed-by: Joao
* | Merge remote branch 'origin/4.6' into qt-master-from-4.6Thiago Macieira2010-02-191-1/+1
|\ \ | | | | | | | | | | | | Conflicts: tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
| * | Revert "Added note to make QList destructor virtual in version 5"Zeno Albisser2010-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | Virtual functions should not be used with copyable types due to slicing. This reverts commit c1db6c2c5a3bbe96a628207af169a032d535426f.
* | | Merge remote branch 'origin/4.6' into integration-master-from-4.6Rohan McGovern2010-02-181-4/+4
|\ \ \ | |/ / | | / | |/ |/| Conflicts: src/corelib/codecs/qtextcodec.h
| * Added note to make QList destructor virtual in version 5Zeno Albisser2010-02-171-1/+1
| | | | | | | | Reviewed-by: TrustMe
| * Change all ptrdiff_t to qptrdiff.Thiago Macieira2010-02-171-3/+3
| | | | | | | | Reviewed-By: Bradley T. Hughes
* | Merge branch '4.6'Thiago Macieira2010-01-131-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt doc/src/deployment/deployment.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/xml/qxmlstream.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h tools/assistant/tools/assistant/centralwidget.cpp tools/linguist/lupdate/main.cpp
| * Update copyright year to 2010Jason McDonald2010-01-061-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | add {QString,QByteArray,QList,QLinkedList,QHash,QMap,QVector}::isSharedWith()Oswald Buddenhagen2009-12-101-0/+1
|/ | | | | | | | | | | | | | | | these functions just compare the d pointers of two objects. this can be used to verify the validity of cached data: you keep a copy of the original data in your cache. consequently, any changes to the original data must detach, so this function reflects whether the cached data is still up-to-date. of course, this is not thread safe, as the data might change right after you check it, but that's a general problem of cache coherency which needs to be handled further up the stack. the functions are internal because the other detaching-related functions are internal as well for reasons beyond me. Reviewed-by: brad
* Fix -Wconversion warnings where possible.David Faure2009-09-131-4/+4
| | | | | | | | | | | | In order to detect "int foo = myQReal" mistakes, one needs to compile with -Wconversion. However that flag triggers many warnings inside Qt. This commit fixes many of them, like qchar.h:295: warning: conversion to 'ushort' from 'unsigned int' may alter its value qglobal.h:1026: warning: conversion to 'qreal' from 'qint64' may alter its value qbytearray.h:441: warning: conversion to 'char' from 'int' may alter its value Other warnings remain (such as those coming from bitfields) Merge-request: 1460 Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* exception safety fix for QList::operator+= (const QList&)mread2009-09-081-7/+12
| | | | | | | | | | | | | | | | The refactoring of current++ and src++ out of the new line makes the code easier to understand but it also seems to be significant at least in the ::isComplex case. I suspect that the ordering increment operations vs throw from new is not well defined, or not implemented as you might hope (with the ++ happening very last). The changes in the catch blocks mean that it deletes the created objects, rather than trying with the first failed object. The test code has been updated with a +=(Container) test, and to force testing of both static and moveable types. Reviewed-by: Harald Fernengel
* qlist.h uses memcpy() without including <string.h> or <cstring>Bernhard Rosenkraenzer2009-09-011-0/+1
| | | | | | | | | | | | | | | | | Attempting to make use of the inlined QList::node_copy without including <string.h> or <cstring> with gcc 4.4 results in (e.g.) /usr/lib64/qt4/include/QtCore/qlist.h: In member function "void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = net::Port]": /usr/lib64/qt4/include/QtCore/qlist.h:600: instantiated from "void QList<T>::detach_helper() [with T = net::Port]" /usr/lib64/qt4/include/QtCore/qlist.h:121: instantiated from "void QList<T>::detach() [with T = net::Port]" /usr/lib64/qt4/include/QtCore/qlist.h:462: instantiated from "void QList<T>::append(const T&) [with T = net::Port]" /usr/src/ark/BUILD/kdenetwork/kget/transfer-plugins/bittorrent/libbtcore/net/portlist.cpp:54: instantiated from here /usr/lib64/qt4/include/QtCore/qlist.h:388: error: "memcpy" was not declared in this scope Task-number: reported, but not yet assigned a number Merge-request: 1388 Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
* Merge branch '4.5' into 4.6Thiago Macieira2009-08-311-13/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: demos/boxes/glshaders.cpp demos/boxes/vector.h demos/embedded/fluidlauncher/pictureflow.cpp demos/embedded/fluidlauncher/pictureflow.h doc/src/desktop-integration.qdoc doc/src/distributingqt.qdoc doc/src/examples-overview.qdoc doc/src/examples.qdoc doc/src/frameworks-technologies/dbus-adaptors.qdoc doc/src/geometry.qdoc doc/src/groups.qdoc doc/src/objecttrees.qdoc doc/src/platform-notes.qdoc doc/src/plugins-howto.qdoc doc/src/qt3support.qdoc doc/src/qtdbus.qdoc doc/src/qtdesigner.qdoc doc/src/qtgui.qdoc doc/src/qtmain.qdoc doc/src/qtopengl.qdoc doc/src/qtsvg.qdoc doc/src/qtuiloader.qdoc doc/src/qundo.qdoc doc/src/richtext.qdoc doc/src/topics.qdoc src/corelib/tools/qdumper.cpp src/gui/embedded/qkbdpc101_qws.cpp src/gui/embedded/qkbdsl5000_qws.cpp src/gui/embedded/qkbdusb_qws.cpp src/gui/embedded/qkbdvr41xx_qws.cpp src/gui/embedded/qkbdyopy_qws.cpp src/gui/embedded/qmousebus_qws.cpp src/gui/embedded/qmousevr41xx_qws.cpp src/gui/embedded/qmouseyopy_qws.cpp src/gui/painting/qpaintengine_d3d.cpp src/gui/painting/qwindowsurface_d3d.cpp src/opengl/gl2paintengineex/glgc_shader_source.h src/opengl/gl2paintengineex/qglpexshadermanager.cpp src/opengl/gl2paintengineex/qglpexshadermanager_p.h src/opengl/gl2paintengineex/qglshader.cpp src/opengl/gl2paintengineex/qglshader_p.h src/opengl/util/fragmentprograms_p.h src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp src/plugins/mousedrivers/linuxis/linuxismousehandler.cpp src/script/parser/qscript.g src/script/qscriptarray_p.h src/script/qscriptasm_p.h src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclassdata_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext.cpp src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmacore.cpp src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptmember_p.h src/script/qscriptobject_p.h src/script/qscriptprettypretty.cpp src/script/qscriptprettypretty_p.h src/script/qscriptvalue.cpp src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptxmlgenerator.cpp src/script/qscriptxmlgenerator_p.h tests/auto/linguist/lupdate/testdata/recursivescan/project.ui tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp tools/linguist/shared/cpp.cpp
| * Update tech preview license header.Jason McDonald2009-08-311-13/+13
| | | | | | | | Reviewed-by: Trust Me
| * Update license headers.Jason McDonald2009-08-111-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Restore QList backward compatibilityHarald Fernengel2009-08-241-3/+5
| | | | | | | | | | | | | | | | Add detach3 and append2, leaving the old functions as they were. This ensures that new code will use the optimized version of QList, and old code will just continue calling the old functions. Reviewed-by: Thiago
* | Revert "Remove the unnecessary double memcpy now too."Harald Fernengel2009-08-241-0/+3
| | | | | | | | This reverts commit 10a0ed3f2e6a71eced5f470f1c3e09d7be58bbc9.
* | Remove the unnecessary double memcpy now too.Thiago Macieira2009-08-211-3/+0
| | | | | | | | | | | | | | The previous commit reintroduced memcpy in detach2(). So we don't need to do memcpy here. Re-add the memcpy when detach3() is introduced.
* | Merge commit 'qt/master'Jason Barron2009-08-131-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/samplebuffers/glwidget.cpp src/corelib/io/qfsfileengine_unix.cpp src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer.cpp src/gui/gui.pro tests/auto/qhttp/tst_qhttp.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp
| * | Update contact URL in license headers.Jason McDonald2009-08-121-1/+1
| |/ | | | | | | Reviewed-by: Trust Me
* | Squashed commit of the topic/exceptions branch.Harald Fernengel2009-08-031-6/+17
| | | | | | | | | | Contains some smaller fixes and renaming of macros. Looks big, but isn't scary at all ;)
* | Merge commit 'qt/master-stable' into 4.6-mergedJason Barron2009-06-301-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore configure.exe src/corelib/concurrent/qtconcurrentthreadengine.h src/corelib/global/qnamespace.h src/gui/graphicsview/qgraphicssceneevent.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_p.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qwidget.h src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkaccesshttpbackend.cpp tests/auto/network-settings.h tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro tests/auto/qvariant/tst_qvariant.cpp
| * Update license headers as requested by the marketing department.Jason McDonald2009-06-161-2/+2
| | | | | | | | Reviewed-by: Trust Me
| * Long live Qt 4.5!Lars Knoll2009-03-231-0/+691
|
* Build fix for GCCE. I believe all auto tests for GCCE were previously failingFrans Englich2009-06-101-1/+8
| | | | | | because of this. Reviewed-by: Brad
* Make Qt exception safer.Robert Griebl2009-06-101-17/+84
| | | | | | | | Squashed commit of the branch haralds-haralds-qt-s60-topics/topic/exceptions, which also contains the full history. Rev-By: Harald Fernengel Rev-By: Ralf Engels
* Long live Qt for S60!axis2009-04-241-0/+691