diff options
Diffstat (limited to 'e-util/e-pilot-map.c')
-rw-r--r-- | e-util/e-pilot-map.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c index 4f985ccace..67aacdcf2a 100644 --- a/e-util/e-pilot-map.c +++ b/e-util/e-pilot-map.c @@ -162,6 +162,45 @@ e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archi g_hash_table_insert (map->uid_map, new_uid, unode); } +void +e_pilot_map_remove_by_pid (EPilotMap *map, guint32 pid) +{ + EPilotMapPidNode *pnode; + EPilotMapUidNode *unode; + + pnode = g_hash_table_lookup (map->pid_map, &pid); + if (!pnode) + return; + + unode = g_hash_table_lookup (map->uid_map, pnode->uid); + + g_hash_table_remove (map->pid_map, &pid); + g_hash_table_remove (map->uid_map, pnode->uid); + + g_free (pnode); + g_free (unode); +} + +void +e_pilot_map_remove_by_uid (EPilotMap *map, const char *uid) +{ + EPilotMapPidNode *pnode; + EPilotMapUidNode *unode; + + unode = g_hash_table_lookup (map->uid_map, uid); + if (!unode) + return; + + pnode = g_hash_table_lookup (map->pid_map, &unode->pid); + + g_hash_table_remove (map->uid_map, uid); + g_hash_table_remove (map->pid_map, &unode->pid); + + g_free (unode); + g_free (pnode); +} + + guint32 e_pilot_map_lookup_pid (EPilotMap *map, const char *uid) { |