summaryrefslogtreecommitdiff
path: root/common/collection/collection.c
AgeCommit message (Collapse)AuthorFilesLines
2009-09-11COLLECTION Functions to deal with hashDmitri Pal1-17/+40
The hashing logic was internal to the collection item. But if someone wants to effectively deal with the items and compare the property to a string he should compare hashes first. But it was not possible without the provided functions. As a result some of the ELAPI modules had to take advantage of knowledge of the item structure. This is bad. So this patch lays foundation for refactoring of the ELAPI code that was using internals of the item directly (file_util.c mostly). Also patch adds a unit test that was required for testing new functionality and for ticket #83
2009-09-10COLLECTION Improvements to copy functionsDmitri Pal1-41/+141
This patch adds better options for copying collections in flat mode. It allows caller of the interface to control prefixing of the fields when one collection is appended to another. It also avoids creating prefixes when the collection is simply copied in flat mode. Also for ELAPI I realized that the most efficient way to deal with the "resolved" event (event where all templeted values are actually replaced with the real values) is to add a callback capability to a copy collection function so that the callback can be used to modify the data (resolve it) while the copy operation is in progress. This approach eliminates the need for separate set of lookups after the event is already copied.
2009-09-09COLLECTION Copy collection flat with concatenated namesDmitri Pal1-217/+288
This patch addresses several issues: a) Adds capability to add or copy the collections in flattened mode but construct names of attributes in dotted notation. For example when you append collection "sub" with items "foo" and "bar" previously you could add them as "foo" and "bar" not you can flatten them and the names will be "sub.foo" and "sub.bar" this allows better processing of the attributes in the elapi message. b) Removes old implemntation of the copy collection function. c) Removes the col_set_timestamp, this functionality has been moved to ELAPI long ago. d) Updates collection unit test. e) Updates elapi to use new functionality f) Updates elapi unit test Have run under valgrind with no problems.
2009-08-20COMMON Fixes to return values, errno, leaksDmitri Pal1-28/+43
Started looking at the ticket #107 related to traverse functions. Realized that the return values are not consistent. That ovelapped with the work that I wanted to do for ticket #103 - errno cleanup. So I (across collection, INI and ELAPI): * Made the return codes consistent (where found) * Removed errno where it is not needed While was testing used valgrind and found a nasty problem when the value was added to collection with overwriting duplicates the count was decreased improperly. Fixing collection.c to not decrease count made valgrind happy. While I was debugging this I also spotted several build warnings in trace statements when the " exp ? v1 : v2 " was used. Fixed those. In ini_config.c there was a trace stament that used variable after it was freed. Removed trace stament.
2009-07-20COLLECTION & INI CleanupDmitri Pal1-14/+26
I started to cleanup the unit tests from the type cust around NULL and found several problems that I had to address: 1) The choice of the "." as a search separator turned out to be a poor choice. The problem was that the file name has "." and INI was relaying on files to be used as property names. I corrected that part in the INI but after discussion with Simo we decided to switch from "." to "!" as special symbol anyways. 2) Found that the property rename was not reinitializing the hash. Corrected. Added ticket to add unit tests around it (#83).
2009-07-16COLLECTION Improving searchesDmitri Pal1-5/+56
Addressing ticket #71. The searches were not taking advantage of the hashes, now they are.
2009-07-16COLLECTION Add remove item functionsDmitri Pal1-2/+60
The remove functions extract and remove items, they act differently from the way the delete_property function works. The new functions allow deletion with the disposition while the delete_property only deletes specified property. The delete_property function is left as is since there are some use cases when it is more efficient to use it rather than new remove_item_xxx ones.
2009-07-15ELAPI First part of the interfaceDmitri Pal1-0/+2
This is just a part of the interface, a beginning. Most likely some of the functions will be altered but it is a starting point. For example in future there will be a way to override some of the parts of the default template using the application configuration file. Removed obfuscation of the data types based on discussion with Simo.
2009-07-15COLLECTION Fixed: iterator_up and insert_into_currentDmitri Pal1-3/+15
During a review of the previous patch the two issues were found: a) The col_iterator_up function was not implemented properly so it got reworked. New implementation changes the way error condition is handled. Comments were updated accordingly. b) There was a mising check for validity of the argument in the col_insert_into_current function. Check was added. c) Unit test modified to reflect the change in functionality.
2009-07-15COLLECTION Adding flat traversal & copyDmitri Pal1-41/+237
The collection is hearachical. The flattening of the collection was not implemented before both for traversal and copying. This patch introduces functionality to traverse or iterate through collection as flat set and also copy collection into another flattening it and automatically resolving conflicts. Also imptoved tracability and fixed memory leak in unbind iterator code.
2009-07-06COLLECTION Removing static placeholder structure.Dmitri Pal1-5/+19
There was a static global structure used in iteration and in traversing the collection. It has been removed and replaced with a better solution.
2009-07-03Clean up warnings in common/Simo Sorce1-29/+29
Fix consts and function declarations
2009-07-02Changing function names for collection API.Dmitri Pal1-562/+560
Patch prepends prefix "col_" to all functions related to collection. This caused some formatiing issues so the alignement was addressed too.
2009-07-01Adding INSERT into collection functionality.Dmitri Pal1-826/+984
Add was always insterting at the end of the collection. With this change one can control where the item is inserted and deal with the duplicates too. Also one now can extract items from collection using absolute and relative disposition. Using more advanced hashing function.
2009-04-09INI component: Fixed issues introduced by cleanup.Dmitri Pal1-4/+3
Added a few new functions. Cleaned code that was subject to conditional build. Fixed the floating point conversion. Keep const values as const.
2009-04-07Fix const warningsSimo Sorce1-72/+92
2009-04-07Style fixes for /commonSimo Sorce1-790/+953
2009-04-06Clean up a lot of warnings in Collection and INI parserStephen Gallagher1-6/+1
2009-04-06First commit of basic collection API.Dmitri Pal1-0/+2481