From: Wolfgang Denk Date: Thu, 16 Apr 2015 06:25:34 +0200 Subject: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset() In-Reply-To: <1429146849-11994-3-git-send-email-sjg@chromium.org> References: <1429146849-11994-1-git-send-email-sjg@chromium.org> <1429146849-11994-3-git-send-email-sjg@chromium.org> Message-ID: <20150416042534.52CD7383285@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, In message <1429146849-11994-3-git-send-email-sjg@chromium.org> you wrote: > Unfortunately memset() is not always available, so provide a substitute when > needed. > +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT) > memset((void *)gd, '\0', sizeof(*gd)); > +#else > + int *ptr = (int *)gd; > + int *end = (int *)(gd + 1); > + > + while (ptr < end) > + *ptr++ = 0; > +#endif Please don't declare variables in the middle of the code. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Command, n.: Statement presented by a human and accepted by a computer in such a manner as to make the human feel as if he is in control.