This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] malloc: Use current (C11-style) atomics for fastbin access
- From: DJ Delorie <dj at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 12 Nov 2018 19:31:50 -0500
- Subject: Re: [PATCH] malloc: Use current (C11-style) atomics for fastbin access
Florian Weimer <email@example.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.