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