Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/usr.sbin/sysinst



Martin Husemann wrote:

> On Tue, Feb 26, 2019 at 01:09:35PM +0000, Joerg Sonnenberger wrote:
> > Module Name:	src
> > Committed By:	joerg
> > Date:		Tue Feb 26 13:09:35 UTC 2019
> > 
> > Modified Files:
> > 	src/usr.sbin/sysinst: run.c
> > 
> > Log Message:
> > Avoid string + int warning.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/run.c
>
> What compiler warns and what are the exact details that make it warn?
> The idiom you used is IMHO extremely ugly, and I would usually rework
> it - but since I can't test that will likely break your build again.
>
> I would do: const char thirty_dashes[] = "---..---";
> and then const char * dashes = thirty_dashes +  m; addstr(dasches);

Looking at the code in question, is reducing the number of calls to
addstr() really something that needs to be optimised?  A simple

	for (n = 0; n < win->ws_col; n++)
		addstr("-");

is a lot easier to understand!

Cheers,
Simon.


Home | Main Index | Thread Index | Old Index