Re: [dev] [st] [PATCH] Refactor xsetcolorname()

From: Christoph Lohmann <20h_AT_r-36.net>
Date: Sun, 01 Jun 2014 16:20:44 +0200

Greetings.

On Sun, 01 Jun 2014 16:20:44 +0200 FRIGN <dev_AT_frign.de> wrote:
> Hello,
>
> attached is a small patch to refactor xsetcolorname().
> Note the high similarity to xloadcols(). I wonder how necessary it is
> to realloc if name==NULL, given dc.col[] is only read except in
> xloadcols(), where exactly the same stuff is done to each array-item as
> repeated in xsetcolorname().
>
> If I'm wrong, let me know. If not, we could skip the entire if(!
> name)-part.

The xsetcolorname() function should be conservative in its input. Since
it is only called from escape input it shouldn’t overwrite a dc.col if
something failed. I fixed this and refactored to the function according
to your patch, which removed the temporary variables.

Second, I standardized the code on »color«. There is »colour«, but not
in st.

Thanks for the patch.


Sincerely,

Christoph Lohmann
Received on Sun Jun 01 2014 - 16:20:44 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 01 2014 - 17:24:06 CEST