Changeset 56566 in vbox for trunk/src/VBox/GuestHost/OpenGL/util
- Timestamp:
- Jun 20, 2015 8:10:59 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101192
- Location:
- trunk/src/VBox/GuestHost/OpenGL/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/hash.c
r55617 r56566 433 433 } 434 434 435 void crFreeHashtableEx(CRHashTable *hash, CRHashtableCallbackEx deleteFunc, void *pData) 436 { 437 int i; 438 CRHashNode *entry, *next; 439 440 if (!hash) return; 441 442 #ifdef CHROMIUM_THREADSAFE 443 crLockMutex(&hash->mutex); 444 #endif 445 446 for (i = 0; i < CR_NUM_BUCKETS; i++) 447 { 448 entry = hash->buckets[i]; 449 while (entry) 450 { 451 next = entry->next; 452 /* Clear the key in case crHashtableDelete() is called 453 * from this callback. 454 */ 455 entry->key = 0; 456 if (deleteFunc && entry->data) 457 { 458 (*deleteFunc)(entry->data, pData); 459 } 460 crFree(entry); 461 entry = next; 462 463 } 464 } 465 crFreeHashIdPool(hash->idPool); 466 467 #ifdef CHROMIUM_THREADSAFE 468 crUnlockMutex(&hash->mutex); 469 crFreeMutex(&hash->mutex); 470 #endif 471 472 crFree(hash); 473 } 474 475 435 476 void crHashtableLock(CRHashTable *h) 436 477 { … … 585 626 } 586 627 628 void crHashtableDeleteEx(CRHashTable *h, unsigned long key, CRHashtableCallbackEx deleteFunc, void *pData) 629 { 630 unsigned int index = crHash( key ); 631 CRHashNode *temp, *beftemp = NULL; 632 633 #ifdef CHROMIUM_THREADSAFE 634 crLockMutex(&h->mutex); 635 #endif 636 for (temp = h->buckets[index]; temp; temp = temp->next) 637 { 638 if (temp->key == key) 639 break; 640 beftemp = temp; 641 } 642 if (temp) 643 { 644 if (beftemp) 645 beftemp->next = temp->next; 646 else 647 h->buckets[index] = temp->next; 648 h->num_elements--; 649 if (temp->data && deleteFunc) { 650 (*deleteFunc)(temp->data, pData); 651 } 652 653 crFree(temp); 654 } 655 656 crHashIdPoolFreeBlock(h->idPool, key, 1); 657 #ifdef CHROMIUM_THREADSAFE 658 crUnlockMutex(&h->mutex); 659 #endif 660 } 661 662 587 663 void crHashtableDeleteBlock( CRHashTable *h, unsigned long key, GLsizei range, CRHashtableCallback deleteFunc ) 588 664 { -
trunk/src/VBox/GuestHost/OpenGL/util/util.def
r53374 r56566 78 78 crHashtableAdd 79 79 crHashtableDelete 80 crHashtableDeleteEx 80 81 crHashtableSearch 81 82 crHashtableReplace … … 87 88 crAllocHashtableEx 88 89 crFreeHashtable 90 crFreeHashtableEx 89 91 crHashtableGetDataKey 90 92 crDetermineEndianness
Note:
See TracChangeset
for help on using the changeset viewer.