Re: [dev] [st] [PATCH 4/3] tresize: remove unnecessary if
On Sun, Apr 12, 2015 at 08:29:55AM +0000, noname wrote:
> ---
> st.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/st.c b/st.c
> index 109122e..f183803 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -2788,10 +2788,8 @@ tresize(int col, int row) {
> free(term.line[i]);
> free(term.alt[i]);
> }
> - if(i > 0) {
> - memmove(term.line, term.line + i, row * sizeof(Line));
> - memmove(term.alt, term.alt + i, row * sizeof(Line));
> - }
> + memmove(term.line, term.line + i, row * sizeof(Line));
> + memmove(term.alt, term.alt + i, row * sizeof(Line));
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.
> for(i += row; i < term.row; i++) {
> free(term.line[i]);
> free(term.alt[i]);
> --
> 1.8.4
>
>
Received on Sun Apr 12 2015 - 10:41:36 CEST
This archive was generated by hypermail 2.3.0
: Sun Apr 12 2015 - 10:48:08 CEST