17ec681f3Smrg 27ec681f3Smrg#ifndef _NINE_PDATA_H_ 37ec681f3Smrg#define _NINE_PDATA_H_ 47ec681f3Smrg 57ec681f3Smrg#include "util/hash_table.h" 67ec681f3Smrg 77ec681f3Smrgstruct pheader 87ec681f3Smrg{ 97ec681f3Smrg boolean unknown; 107ec681f3Smrg GUID guid; 117ec681f3Smrg DWORD size; 127ec681f3Smrg}; 137ec681f3Smrg 147ec681f3Smrgstatic bool 157ec681f3Smrght_guid_compare( const void *a, 167ec681f3Smrg const void *b ) 177ec681f3Smrg{ 187ec681f3Smrg return GUID_equal(a, b); 197ec681f3Smrg} 207ec681f3Smrg 217ec681f3Smrgstatic uint32_t 227ec681f3Smrght_guid_hash( const void *key ) 237ec681f3Smrg{ 247ec681f3Smrg unsigned i, hash = 0; 257ec681f3Smrg const unsigned char *str = key; 267ec681f3Smrg 277ec681f3Smrg for (i = 0; i < sizeof(GUID); i++) { 287ec681f3Smrg hash = (unsigned)(str[i]) + (hash << 6) + (hash << 16) - hash; 297ec681f3Smrg } 307ec681f3Smrg 317ec681f3Smrg return hash; 327ec681f3Smrg} 337ec681f3Smrg 347ec681f3Smrgstatic void 357ec681f3Smrght_guid_delete( struct hash_entry *entry ) 367ec681f3Smrg{ 377ec681f3Smrg struct pheader *header = entry->data; 387ec681f3Smrg void *header_data = (void *)header + sizeof(*header); 397ec681f3Smrg 407ec681f3Smrg if (header->unknown) { IUnknown_Release(*(IUnknown **)header_data); } 417ec681f3Smrg FREE(header); 427ec681f3Smrg} 437ec681f3Smrg 447ec681f3Smrg#endif /* _NINE_PDATA_H_ */ 45