buflib: add comment in handle_alloc, remove a dead store
It isn't obvious why the "handle->val = -1" at the end of handle_alloc is needed so add an explanatory comment. But "handle->val = 1" prior to calling handle_free is simply a dead store. Change-Id: I9ab4e96e87e940cfd1a2ed56f089287821669c73
This commit is contained in:
parent
840f6b79c7
commit
4d3bf1c446
1 changed files with 4 additions and 1 deletions
|
@ -207,7 +207,11 @@ union buflib_data* handle_alloc(struct buflib_context *ctx)
|
|||
* and the found handle, therefore we can update first_free_handle */
|
||||
ctx->first_free_handle = handle - 1;
|
||||
|
||||
/* We need to set the table entry to a non-NULL value to ensure that
|
||||
* compactions triggered by an allocation do not compact the handle
|
||||
* table and delete this handle. */
|
||||
handle->val = -1;
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -613,7 +617,6 @@ buffer_alloc:
|
|||
{
|
||||
goto buffer_alloc;
|
||||
} else {
|
||||
handle->val=1;
|
||||
handle_free(ctx, handle);
|
||||
return -2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue