Skip to content

Commit

Permalink
When releasing an handle return the number of filled entries
Browse files Browse the repository at this point in the history
  • Loading branch information
aerisarn committed Feb 25, 2024
1 parent efcd556 commit 239e0a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/gallium/auxiliary/util/u_handle_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ handle_table_get(struct handle_table *ht,
}


void
int
handle_table_remove(struct handle_table *ht,
unsigned handle)
{
Expand All @@ -243,17 +243,19 @@ handle_table_remove(struct handle_table *ht,
assert(ht);
assert(handle);
if(!handle || !ht || handle > ht->size)
return;
return 0;

index = handle - 1;
object = ht->objects[index];
if (!object)
return;
return 0;

handle_table_clear(ht, index);

if(index < ht->filled)
ht->filled = index;

return ht->filled;
}


Expand Down
2 changes: 1 addition & 1 deletion src/gallium/auxiliary/util/u_handle_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ handle_table_get(struct handle_table *ht,
unsigned handle);


void
int
handle_table_remove(struct handle_table *ht,
unsigned handle);

Expand Down

0 comments on commit 239e0a2

Please sign in to comment.