diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-11-01 12:40:36 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-11-01 12:40:36 +0100 |
commit | 1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1 (patch) | |
tree | 164fbd51f937f62cab5e212674cd16fa223286d8 /util.c | |
parent | afb3c6b921053af7d92701f3580be6c04a337990 (diff) | |
download | hardware_replicant_libsamsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.tar.gz hardware_replicant_libsamsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.tar.bz2 hardware_replicant_libsamsung-ril-1d47003d41e5c2a84c831b32a345ae3c6bbfa6f1.zip |
Reworked RIL requests, globals, SIM status, client
* Handling ril requests with lists
* Renamed functions to complete requests
* Globals (most of them) are held in ril_data
* Renamed SIM_Status to ril_sim_state
* Renamed client object to data
* Moved client funcs to a sub-structure
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -29,6 +29,44 @@ #include "samsung-ril.h" /** + * List + */ + +struct list_head *list_head_alloc(void *data, struct list_head *prev, struct list_head *next) +{ + struct list_head *list; + + list = calloc(1, sizeof(struct list_head)); + if(list == NULL) + return NULL; + + list->data = data; + list->prev = prev; + list->next = next; + + if(prev != NULL) + prev->next = list; + if(next != NULL) + next->prev = list; + + return list; +} + +void list_head_free(struct list_head *list) +{ + if(list == NULL) + return; + + if(list->next != NULL) + list->next->prev = list->prev; + if(list->prev != NULL) + list->prev->next = list->next; + + memset(list, 0, sizeof(struct list_head)); + free(list); +} + +/** * Converts a hexidecimal string to binary */ void hex2bin(const char *data, int length, unsigned char *buf) |