Re: [dev] [st] [PATCH 4/3] tresize: remove unnecessary if

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Sun, 12 Apr 2015 11:35:42 +0200

Heyhey

On Sun, Apr 12, 2015 at 08:56:40AM +0000, noname_AT_inventati.org wrote:
> On Sun, Apr 12, 2015 at 10:41:36AM +0200, Silvan Jegen wrote:
> > I was thinking about this option too but in that case you would be
> > calling memmove with an identical src and dst when i == 0. The man page
> > for glibc memmove(3) does not mention anything about this being a noop
> > so I am not sure that is a good thing to do.
>
> "The memory areas may overlap: copying takes place as though the bytes in
> src are first copied into a temporary array that does not overlap src
> or dest, and the bytes are then copied from the temporary array to dest."
>
> src == dest is just a case of overlapping areas, it must work.

I don't doubt that it will work :)

I just wonder if it really will be copying the data around into a
temporary array for no reason when i == 0 (either in glibc or in another
libc).

I don't think it is worth removing this if and potentially copying data
around to no avail. At the same time I don't think this function is
called very often so in practice it will not matter in either case. I
just wanted to point it out so people can take it into consideration
before deciding to apply your patches.
Received on Sun Apr 12 2015 - 11:35:42 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 12 2015 - 11:48:03 CEST