Define list compression with its function.
More...
#include "comp_list.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Detailed Description
Define list compression with its function.
- Author:
- Didier Barvaux <didier@barvaux.org>
Function Documentation
Are the two given lists equal?
We compare only the list structure, not the list content. Two lists with the same items in the same order, but with different content, are considered equals.
- Parameters:
-
list1 | The first list to compare |
list2 | The other list to compare |
- Returns:
- true if the two lists are equal, false if they aren't
Reset the given list item.
- Parameters:
-
list_item | The item to reset |
Update the content the given compressed item.
- Parameters:
-
list_item | The item to update |
item_type | The type of the item to update |
item_data | The data to update item with |
item_len | The data length (in bytes) |
- Returns:
- true if the update was successful, false otherwise
Update the content of the given compressed item if it changed.
- Parameters:
-
cmp_item | The callback function to compare two items |
list_item | The item to update |
item_type | The type of the item to update |
item_data | The data to update item with |
item_len | The data length (in bytes) |
- Returns:
- 0 if the item doesn't need to be updated, 1 if the update was successful, -1 if a problem occurred
Reset the state of the given compressed list.
- Parameters:
-
Does the first list contains the second list?
We compare only the list structure, not the list content. A list supersedes another list if all the items of the second list are present in the first list in the same order.
- Parameters:
-
large | The large list that should supersedes the small list |
small | The small list that should be superseded by the large list |
- Returns:
- true if the large list supersedes the small list