[PATCH] malloc: Use current (C11-style) atomics for fastbin access

DJ Delorie dj@redhat.com
Tue Nov 13 00:31:00 GMT 2018


Florian Weimer <fweimer@redhat.com> writes:
> 	* malloc/malloc.c (fastbin_push_entry): New function.
> 	(fastbin_pop_entry): Likewise.  Replaces REMOVE_FB.
> 	(REMOVE_FB): Remove macro.
> 	(_int_malloc): Use fastbin_pop_entry and reindent.
> 	(_int_free): Use fastbin_push_entry.
> 	(malloc_consolidate): Use atomic_exchange_acquire.

All good with one minor nit...

> +	if (head == NULL)
> +	  return NULL;
> +	else
> +	  tail = head->fd;

This "else" is superfluous.  You can just have the tail = head->fd;
statement after the "return NULL;".  I think putting it in an "else"
makes the (false) claim that it might have been executed otherwise.



More information about the Libc-alpha mailing list