From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Wed, 13 Mar 2013 17:06:46 +0100 Subject: [U-Boot] C99 and dynamic arrays In-Reply-To: References: Message-ID: <20130313160646.5EE42200048@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 you wrote: > > >> Given that we seem to allow C99 features in U-Boot I wonder if it > >> would be OK to use dynamic arrays in SPL? Strange. I can see the follow-ups, but I cannot see the original posting? > In the function pow_mod(), I would like to replace: > > val = malloc(key->len * sizeof(uint32_t)); > > with: > > uint32_t val[key->len]; > > malloc() adds at least 1KB, perhaps 2KB. I think it is perfectly OK to do that. Actually I think we already do this in a number of places. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 "The trouble with doing something right the first time is that nobody appreciates how difficult it was." - Walt West