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

From: Christoph Lohmann <>
Date: Sun, 01 Jun 2014 16:20:44 +0200


On Sun, 01 Jun 2014 16:20:44 +0200 FRIGN <> 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.


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