Date: Sat, 17 Dec 2011 22:51:03 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Kostik Belousov <kostikbel@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228663 - head/usr.sbin/lpr/filters Message-ID: <4EED0EC7.90203@FreeBSD.org> In-Reply-To: <20111217214440.GB50300@deviant.kiev.zoral.com.ua> References: <201112172137.pBHLbMAo077674@svn.freebsd.org> <20111217214440.GB50300@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2011-12-17 22:44, Kostik Belousov wrote: >> #define MAXWIDTH 132 >> #define MAXREP 10 >> @@ -115,7 +116,7 @@ main(int argc, char *argv[]) >> acctfile = cp; >> } >> >> - for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' '); >> + memset(buf, ' ', sizeof(buf)); >> done = 0; > buf is two-dimensional array. This change looks wrong. The for loop took the address of the left-top corner of the two-dimensional array, and iterated with a char pointer to the address just after the right-bottom corner of the array. It was in effect a memset, just hand-written.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EED0EC7.90203>