summaryrefslogtreecommitdiffstats
path: root/qdict.c
Commit message (Collapse)AuthorAgeFilesLines
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-6/+6
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Introduce qdict_get_try_bool()Luiz Capitulino2010-07-011-0/+18
| | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QDict: Introduce new iteration APILuiz Capitulino2010-07-011-0/+37
| | | | | | | | | | | | | | | | | | | | | | It's composed of functions qdict_first() and qdict_next(), plus functions to access QDictEntry values. This API was suggested by Markus Armbruster <armbru@redhat.com> and it offers full control over the iteration process. The usage is simple, the following example prints all keys in 'qdict' (it's hopefully better than any English description): QDict *qdict; const QDictEntry *ent; [...] for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) { printf("%s ", qdict_entry_key(ent)); } Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QDict: Introduce functions to retrieve QDictEntry valuesLuiz Capitulino2010-07-011-0/+21
| | | | | | | | | | | Next commit will introduce a new QDict iteration API which returns QDictEntry entries, but we don't want users to directly access its members since QDictEntry should be private to QDict. In the near future this kind of data type will be turned into a forward reference. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QDict: Small terminology changeLuiz Capitulino2010-07-011-12/+12
| | | | | | | | | | Let's call a 'hash' only what is returned by our hash function, anything else is a 'bucket'. This helps avoiding confusion with regard to how we traverse our table. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* QDict: Rename 'err_value'Luiz Capitulino2010-07-011-3/+3
| | | | | | A missing key is not an error. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Fix qtypes' licensesLuiz Capitulino2010-05-191-3/+3
| | | | | | | | - Change from GPL to LGPL - Add license text when missing - Minor cosmetic changes to make all headers look the same Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Replace assert(0) with abort() or cpu_abort()Blue Swirl2010-03-181-2/+1
| | | | | | | | | When building with -DNDEBUG, assert(0) will not stop execution so it must not be used for abnormal termination. Use cpu_abort() when in CPU context, abort() otherwise. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix build with -DNDEBUG in CFLAGSBlue Swirl2010-03-131-0/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* QDict: New qdict_get_double()Markus Armbruster2010-02-031-0/+24
| | | | | | | Helper function just like qdict_get_int(), just for QFloat/double. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Introduce qdict_get_qdict()Luiz Capitulino2010-01-261-0/+13
| | | | | | | A helper to retrieve a QDict from a QDict. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Fix size updateLuiz Capitulino2009-12-181-2/+1
| | | | | | | | | Key replacement should not update the dictionary's size. This commit also adds a test for the bug. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Introduce qdict_get_qlist()Luiz Capitulino2009-12-121-0/+13
| | | | | | | A helper function to get a QList from a QDict. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Introduce qdict_get_qbool()Luiz Capitulino2009-12-121-0/+15
| | | | | | | | This is a helper function that does type checking before retrieving a QBool from the dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QDict: Introduce qdict_iter()Luiz Capitulino2009-11-171-0/+19
| | | | | | | | This adds iterator support to QDict, it will be used by the (to be introduced) QError module. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix sys-queue.h conflict for goodBlue Swirl2009-09-121-7/+7
| | | | | | | | | | | | | | | Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Shuffle lines to avoid gcc 3 warning about redundant redeclarationBlue Swirl2009-09-041-6/+6
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce QDictLuiz Capitulino2009-09-041-0/+297
QDict is a high-level dictionary data type that can be used to store a collection of QObjects. A unique key is associated with only one QObject. The following functions are available: - qdict_new() Create a new QDict - qdict_put() Add a new 'key:object' pair - qdict_get() Get the QObject of a given key - qdict_del() Delete a 'key:object' pair - qdict_size() Return the size of the dictionary - qdict_haskey() Check if a given 'key' exists Some high-level helpers to operate on QStrings and QInts objects are also provided. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud