summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-05-031-17/+16
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/gui/kernel/qguiapplication.h src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow.h tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp Change-Id: I62a8805577a7940d4d36bed985eb3e7019d22f2e
| * Remove redundant check in QMetaType::typeInfoJędrzej Nowacki2012-04-181-2/+1
| | | | | | | | | | | | | | The check was introduced when void was not a fully defined type. Change-Id: I4df8607999436f8db92be77fc8fd203fc66c2816 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
| * Hide QTypeModuleInfo in a private namespace.Jędrzej Nowacki2012-04-181-15/+15
| | | | | | | | | | | | | | The class is private and shouldn't pollute global namespace. Change-Id: Ib44473fd72e5a70096eeff1662e88b29263d19c6 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Fix regression in connectNotify(const char *) emissionKent Hansen2012-05-011-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reimplementations of connectNotify() and disconnectNotify() can assume that the signal argument is in normalized form, but after the introduction of the Qt5 meta-object format, it could happen that it's not. The problem is that the internal QArgumentType class, which attempts to resolve a typename to a type id, was calling QMetaType::type(). QMetaType::type() falls back to trying the normalized form of the typename if the original argument can't be resolved as a type (this behavior isn't documented, but that's how it works). This means that e.g. QMetaType::type("const QString &") returns QMetaType::QString. Since QMetaObjectPrivate::indexOfMethodRelative() (more specifically, the methodMatch() helper function) prefers to compare type ids over typenames (since the type ids are stored directly in the meta- object data for built-in types), the method lookup would *succeed* for signatures with non-normalized built-in typenames as parameters. QObject::connect() would then think that it did not have to normalize the signature (see "// check for normalized signatures"). The consequence was that the original, non-normalized form got passed to connectNotify(). This commit introduces an internal typename-to-type function that is the same as QMetaType::type(), except it doesn't try to normalize the name. This way, the only place where normalization can occur in the signature-to-meta-method processing is through the calls to QMetaObject::normalizedSignature() in QObject::connect() itself. The implication is that there are now cases where the method signature will be decoded and processed twice, where processing it once was sufficient before. On the other hand, it is consistent with the pre-Qt5-meta-object behavior, where we predict that the signature is already normalized, and only perform (comparatively costly) normalization if the initial lookup fails. Change-Id: Ie6b60f60b0f9a57ebd378d980329dac62d57bbd9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Provide versions of qRegisterMetaType() that do not normalize typename.Martin Jones2012-04-201-8/+41
| | | | | | | | | | | | | | | | | | QML is quite capable of providing typenames in the correct format. qRegisterNormalizedMetaType() does not normalize the typename, so avoids the huge overhead. Change-Id: I96c9a42fe0b5d36ac05a9247f6507dbf9583fa67 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-19/+11
|/ | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Remove duplicated template code.Jędrzej Nowacki2012-04-031-43/+2
| | | | | | | | | | | | Unify TypeDefinitions specializations. I'm not aware of any reason why QVariant should have a separate set of supported types during bootstrapping phase. It would cause only crashes. As a side effect the patch reduces size of core and gui libraries. Change-Id: I5140d9d3daee39a0171bc718bf46dab6b28085ec Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Get rid of compilation warning.Jędrzej Nowacki2012-03-231-0/+1
| | | | | | | metaObject pointer will be used in future. Change-Id: I1f335687ad1aa443def21efcb5d4a2eaf3583c44 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QtJson types to meta-type systemKent Hansen2012-03-201-0/+20
| | | | | | | | | | Make QJsonValue, QJsonObject, QJsonArray and QJsonDocument first-class meta-types. This is an enabler for a lightweight integration with QML. Change-Id: I4725efdd2746cf97fd26d3632a99e8eee849f834 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add API and reserve space for storing the QMetaObject with the QMetaType.Stephen Kelly2012-03-201-3/+6
| | | | | | | | In Qt 5.1, http://codereview.qt-project.org/#change,19113 can be rebased on top of this change in a compatible way. Change-Id: If7ac0481a3b2a874528de4ef6ea7535501a4ac71 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge master into api_changesKent Hansen2012-03-161-244/+58
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
| * Reimplement QMetaType::create method.Jędrzej Nowacki2012-03-141-228/+55
| | | | | | | | | | | | | | | | | | The method was reimplemented using QMetaTypeSwitcher. That should reduce maintenance costs, because types list is populated automatically now. Change-Id: I6637f7b928218ce60b2ec7436079a44089f0e00f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * Unify QMetaType::TypeFlags detection.Jędrzej Nowacki2012-03-141-6/+2
| | | | | | | | | | | | | | | | | | Duplicated code was removed. As an side effect: - one runtime flag check was replaced by a compile time check. - is enum flag can be used together with built-in types. Change-Id: I54173e7b07ce7e487d3cc21ba24dcccd28b5d049 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QRegularExpression: QMetaType and QVariant supportGiuseppe D'Angelo2012-03-141-4/+27
| | | | | | | | | | | | | | | | | | Removed the Q_DECLARE_METATYPE in favour of first-class support inside QMetaType and QVariant. Change-Id: I904236822bfab967dc0fbd4d4cc2bcb68c741adc Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-03-121-2/+3
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
| * Crash fix in QMetaType::typeFlags.Jędrzej Nowacki2012-03-111-1/+1
| | | | | | | | | | | | | | The function is public, so it should validate input instead of crashing Change-Id: Id67463b0b61ab74a76c1ede7f052bdbed37822b6 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
| * Crash fix in QMetaType::typeName.Jędrzej Nowacki2012-03-081-2/+3
| | | | | | | | | | | | | | The function is public, so it should validate input instead of crashing Change-Id: Ifd9f1110f8631f942929d85db6a57eee7afffb6a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-2/+5
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Improve safeness of QMetaType::registerType.Jędrzej Nowacki2012-03-061-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This internal function is abused by some modules to create dynamic types in metatype system. In Qt5 more non-optional arguments were added to the function and to keep temporary source compatibility an overload was created. QMetaType code assumes that every known type has properly defined basic operations like creation and destruction. Setting a helper function pointer to null value is asking for a crash, because the code doesn't check for that value, the null pointer may be called. Change-Id: I5ca7454a70c308e01de26fab23481b3c94c22371 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Introduce QMetaType::UnknownType.Jędrzej Nowacki2012-03-021-27/+35
|/ | | | | | | | | | | | | | | | | QMetaType::Void was ambiguous, it was pointing to a valid type (void) and in the same time it was signaling errors in QMetaType. There was no clean way to check if returned type was valid void or some unregistered type. This feature will be used by new QMetaObject revision which will store type ids instead of type names. So it will be easy to distinguish between: void mySlot(); MyUnregisteredType mySlot(); Change-Id: I73ff097f75585a95e12df74d50c6f3141153e771 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Reduce QtCore lib binary size by around ~3KB, by removing template codeJędrzej Nowacki2012-02-271-4/+4
| | | | | | | | | | | | | | | Reusing a template is much better then creating a new one, even if it should inline the same code. For some reason replacing T* by void* force gcc to remove a few bytes per template instantiation too, it is not really significant, but it alows us to simplify the code. Benchmarks don't show any regressions. Change-Id: I4fdf1e4dc311b23021eb5758605602937d05b183 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QMetaTypeSwitcher::UnknownType to NotBuiltinType.Jędrzej Nowacki2012-02-231-6/+6
| | | | | | | | UnknownType suggest that a type is unknown to QMetaType, but QMetaTypeSwitcher is not checking for custom types. Change-Id: I6b8b692e0f20bed286c713672b35fb15757d389e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Implement new static less API for QMetaType.Jędrzej Nowacki2012-02-161-0/+170
| | | | | | | | | | | | | | Currently QMetaType API contains almost only static methods. This works nice until someone needs more information or needs to do more operations on a type. In this case every function call has to do type dispatch. This API allows to avoid redundant type dispatching, by caching a type information in a QMetaType instance. It gives significant performance boost especially for custom types (up to 9x). Change-Id: I223d066268402e072e41ca1d0a3e7bc160655d7f Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Introduce Q_DECLARE_OPAQUE_POINTERJoão Abecasis2012-02-091-0/+20
| | | | | | | | | | | | To hide the IsPointerToTypeDerivedFromQObject monstruosity :-) Documentation for Q_DECLARE_METATYPE and qRegisterMetaType was updated to mention requirements on registered types and how they can be circumvented for pointer types with the new macro. Change-Id: If83b037a8e2f28761eb903525e87008107298801 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Code cleanup and micro optimizations in QMetaType.Jędrzej Nowacki2012-02-081-60/+54
| | | | | | Change-Id: I0fbd713fcdf094f9d13acee855b6dd6986695e0d Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Detect incompatibilities in repeated type registrationJoão Abecasis2012-02-071-17/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | QMetaType used to register a typeName and factory functions for creation/destruction of objects. While it would be possible for a single type name to be registered matching different actual types and memory layouts, there was little that could be done about it. Now that QMetaType is tracking type information with a direct impact on data layout and ABI (size and type flags) it is important that we check and detect binary incompatibilities as early as possible. [Such incompatibilities could arise from type name re-use (technically, ODR violations) or, more commonly, as version mismatch between different shared libraries or plugins.] Only type size and flags are checked as function pointers to inline and template or otherwise non-exported functions could trivially differ across translation units and shared libraries. When registering typedef types, a check is made to ensure the same name doesn't get registered as different types. Change-Id: I8211c3de75d4854ce8fafdb620d3a931c206e0c3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Remove QMetaType::unregisterType().Jędrzej Nowacki2012-02-071-30/+0
| | | | | | | | | | | | | | | | | | | | | | | The function hasn't been working properly. It was not well tested, for example it is undefined how QVariant should behave if it contains an instance of an unregistered type. Concept of unregistering types was inspired by plug-in system, but in most supported platforms we do not unload plug-ins. Idea of type unregistering may block optimizations in meta object system, because it would be not possible to cache a type id. QMetaType::type() could return different ids for the same name. Currently QMetaType::unregisterType() is not used in Qt. Change-Id: I878b6e8d91de99f9bcefeab73af2e2ba0bd0cba0 Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Do not crash trying to load or save QModelIndex.Jędrzej Nowacki2012-02-051-0/+2
| | | | | | | | QModelIndex doesn't have data stream operators loading or saving this type should gracefully fail. Change-Id: I6a1a3bab3f83ff4921369a07fdb54ac462eff554 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Reimplement QMetaType::destroy.Jędrzej Nowacki2012-02-051-167/+56
| | | | | | | | New implementation is using QMetaTypeSwitcher, which should reduce maintenance costs. Change-Id: Ibb7bb4b9de0e19c081c087d9eebf0c709118d3b4 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Fix a typo TypeDefiniton -> TypeDefinition.Jędrzej Nowacki2012-02-031-19/+19
| | | | | | | | If you repeat a typo often enough, it becomes the right spelling. But 49 times is definitely not enough :-) Change-Id: I7c0bb29e68e4bff5c67277f9874df8b3ab8b2b54 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* 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>
* Introduce QTypeInfo::sizeOf.Jędrzej Nowacki2012-01-291-2/+1
| | | | | | | | In QMetaType "void" is a regular type, lack of c++ sizeof operator force us to write a template specialization for the type. Change-Id: I9a56e135223b416b8031836d29ef33ef3fb750e4 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Fix null pointer call in QMetaType::destruct().Jędrzej Nowacki2012-01-291-1/+3
| | | | | | | | | | | Logic has a flow causing null pointer call during destruction of an instance of a custom type in bootstrap mode. The patch doesn't include autotests, because we do not test bootstrap mode. Change-Id: Ie70c6f4226cb604f094513621d96a560e84502d7 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Cleanup mess in public type ids.Jędrzej Nowacki2012-01-251-5/+4
| | | | | | | | | | | | | | | | | | There is no reason to keep two separated core types sets. It couldn't be fixed before Qt5 because of binary compatibility promise. This patch merges QMetaType core types with ext core types. This "simple" operation consists of: - QDataStream version was incremented, because type ids are saved in QVariant's data stream. - QMetaType LastExtCoreType and FirstExtCoreType were replaced by LastCoreType, FirstCoreType and new QMetaType::HighestInternalId. - New tests checking QVariant data stream for Qt4 and for Qt5 versions were added. Change-Id: I02dd74d29317365c297a789a4eb7c9c5edc3b231 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Store the is-a QObject fact with the metatype declaration.Stephen Kelly2012-01-241-2/+4
| | | | | | | | | | | | | | This is a source incompatible change for Q_DECLARE_METATYPE(T*), which now requires T to be fully defined. The consequences of this are: * Forward declared types can no longer be declared as a metatype. (though this is a very uncommon thing to do). There is a trivial workaround where necessary. Change-Id: Id74c40088b8c0b466fcd7c55abd616f69acc82c8 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>
* Add QModelIndex as a built-in metatype.Stephen Kelly2012-01-111-0/+15
| | | | | Change-Id: Ib87cfff8b4baee78189f3df5e20d2e1a00d690e1 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove wrong assert from QMetaType.Jędrzej Nowacki2012-01-101-6/+0
| | | | | | | | | | | | | | | We can't assert that QMetaType helper arrays are initialized. In rare situations it may happen that QMetaType compiled without support for an external type (without compiled Gui or Widgets libraries) will be asked for additional information for the type. For example (assuming Qt is compiled with --no-gui): // typeId it may be received over network (QMetaType::QImage) void *ptr = QMetaType::create(typeId); Change-Id: I018a59b23def35c7574e7c921019b5db4f06e800 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Small QMetaType optimization.Jędrzej Nowacki2012-01-101-6/+6
| | | | | | | Prefer compile time check over a runtime. Change-Id: Ib78563083c765d1fd72217c5aa529d0cbb951130 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>
* Registered QUuid in the metatype system as a builtin type.Denis Dzyubenko2012-01-051-0/+14
| | | | | | | Change-Id: I6be6129d9f6bf468ba8a5805cfa0f6f79199afb3 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* Remove redundant template parameter from QMetaType's internal classes.Jędrzej Nowacki2011-12-221-9/+6
| | | | | | | | | Filter doesn't have to be a parameter because we always use DefinedTypesFilter. Change-Id: I19b8eb47a4c50e290cf712f909aaead8fdc94cd9 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Allow QMetaType to register information about movabilityJędrzej Nowacki2011-12-221-2/+80
| | | | | | | We need that information to perform some optimizations in QVariant. Change-Id: Id9a1716e49e4cedd17cd09a32fea4ff003ef61f2 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Make QMetaTypeInterface POD.Jędrzej Nowacki2011-12-191-0/+12
| | | | | | | | | QMetaTypeInterface has to be POD because it is constructed in a static array. Constructors in POD types are not allowed so we will use a macro instead. Change-Id: Iab9ae776dfe4dcd7148558f02d6181c5917aa5c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix a deadlock in QMetaType.Jędrzej Nowacki2011-11-291-8/+12
| | | | | | | | | | | QMetaType should unlock all mutexes guarding custom types data before calling an user code. Task-number: QTBUG-22930 Change-Id: I501d011d6cbd467d8f22402d668e84aa848061b8 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Code cleanup in QVariant and QMetaType.Jędrzej Nowacki2011-11-221-31/+3
| | | | | | | | | QMetaTypeGuiHelper was generalized and renamed to QMetaTypeInterface. From now all types will have common interface which can be used for basic operations. Change-Id: I50d67f4a8081fa0f75c9d530a8211593ec37bc55 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Reimplement some QMetaType methods.Jędrzej Nowacki2011-11-171-369/+205
| | | | | | | | | Methods of QMetaType; sizeOf, construct and destruct were reimplement using QMetaTypeSwitcher. The change should have impact only on maintenance (by removing 3 type switches). Change-Id: Iac3eb52de75d46f12ac32f229a26aec5b5bc7af2 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Reimplement QMetaType::typeName.Jędrzej Nowacki2011-11-171-97/+35
| | | | | | | | | New implementation is slightly faster (~30%) and it is not dependent on order of definitions in QMetType::Type. Which means that we do not have to maintain a separate type list. Change-Id: I0ceb8c919c08afaa55146fbc3f021b78ffc2c063 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add QPolygonF to metatype system.Jędrzej Nowacki2011-11-091-0/+4
| | | | | | | | That was strange that QPolygon was know to QMetaType class but QPolygonF not. Change-Id: I67bb99644b8b1d0fe1aec730619d8048cb78219b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Refactor QMetaType types.Jędrzej Nowacki2011-11-091-22/+8
| | | | | | | | | | | | | | | | QMetaType::Type enum is the main source of type ids. Currently there are many tasks that can be replaced by a smart macro that can iterate over all types. The patch introduces series of FOR_EACH_ macros that may be used for code generation. As the first step the macro was used for Q_DECLARE_BUILTIN_METATYPE to make sure that no type was forgotten. Second step was to use created macros in autotest to improve tests coverage. Change-Id: I34e9ad7bacf02b44b028bc1aad20b1241aacebd3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>