struct struct_def* search_struct(char *name) { struct struct_def *ptr=sdef_list_head; struct type_def *tptr = tdef_list_head; struct type_table_entry *hptr = NULL; int index; int id; while (ptr) { if (strcmp(ptr->name, name)==0) return ptr; else ptr = ptr->next; } while (tptr) { if (strcmp(tptr->name, name)==0) { id = tptr->type->id; index=ID_HASH(id); hptr = type_table[index].head; while (hptr) { if (hptr->id == id) break; hptr=hptr->next; } if (!hptr) { printf("id (%d,%d) not found", (id >> 16) , (id & 0xFF)); return 0; } switch (hptr->type == STRUCTURE) return hptr->info.sdef; }
static void id_release_p (IdentityData_t *p) { IdentityData_t *xp, *prev; unsigned h; if (p->id_creds) { DDS_DataHolder__free (p->id_creds); p->id_creds = NULL; } if (p->perm_cred) { DDS_DataHolder__free (p->perm_cred); p->perm_cred = NULL; } if (p->id_token) { token_unref (p->id_token); p->id_token = NULL; } if (p->perm_token) { token_unref (p->perm_token); p->perm_token = NULL; } h = ID_HASH (p->id); for (xp = id_ht [h], prev = NULL; xp; prev = xp, xp = xp->next) if (xp == p) { if (prev) prev->next = p->next; else id_ht [h] = p->next; break; } xfree (p); }
struct type_table_entry *get_type_entry(int id) { int index; struct type_table_entry *ptr = type_table[index].head; index = ID_HASH(id); while(ptr != NULL) { if (ptr->id == id) return ptr; ptr = ptr->next; } return NULL; }
void add_into_type_table(struct type_table_entry *entry) { int index; index = ID_HASH(entry->id); if (type_table[index].head == NULL) { type_table[index].head = type_table[index].tail = entry; } else { type_table[index].tail->next = entry; type_table[index].tail = entry; } }
IdentityData_t *id_lookup (Identity_t id, unsigned *hp) { IdentityData_t *p; unsigned h = ID_HASH (id); if (hp) *hp = h; for (p = id_ht [h]; p; p = p->next) if (p->id == id) return (p); return (NULL); }
int print_id(int id, long long offset, char * data) { struct type_table_entry *ptr; int index=ID_HASH(id); ptr = type_table[index].head; while (ptr) { if (ptr->id == id) break; ptr=ptr->next; } if (!ptr) { my_printf("id (%d,%d) not found", (id >> 16) , (id & 0xFF)); return 0; }