• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef _NINE_PDATA_H_
3 #define _NINE_PDATA_H_
4 
5 struct pheader
6 {
7     boolean unknown;
8     GUID guid;
9     DWORD size;
10 };
11 
12 static int
ht_guid_compare(void * a,void * b)13 ht_guid_compare( void *a,
14                  void *b )
15 {
16     return GUID_equal(a, b) ? 0 : 1;
17 }
18 
19 static unsigned
ht_guid_hash(void * key)20 ht_guid_hash( void *key )
21 {
22     unsigned i, hash = 0;
23     const unsigned char *str = key;
24 
25     for (i = 0; i < sizeof(GUID); i++) {
26         hash = (unsigned)(str[i]) + (hash << 6) + (hash << 16) - hash;
27     }
28 
29     return hash;
30 }
31 
32 static enum pipe_error
ht_guid_delete(void * key,void * value,void * data)33 ht_guid_delete( void *key,
34                 void *value,
35                 void *data )
36 {
37     struct pheader *header = value;
38     void *header_data = (void *)header + sizeof(*header);
39 
40     if (header->unknown) { IUnknown_Release(*(IUnknown **)header_data); }
41     FREE(header);
42 
43     return PIPE_OK;
44 }
45 
46 #endif /* _NINE_PDATA_H_ */
47