From: Mike Frysinger Date: Thu, 5 Jan 2012 18:21:35 -0500 Subject: [U-Boot] [PATCH] lib/string: added strndup In-Reply-To: <1324577816-26198-1-git-send-email-marathon96@gmail.com> References: <1324577816-26198-1-git-send-email-marathon96@gmail.com> Message-ID: <201201051821.35774.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 22 December 2011 13:16:56 Grant Erickson wrote: > +#ifndef __HAVE_ARCH_STRNDUP > +extern char * strndup(const char *,__kernel_size_t); > +#endif no space after that first "*", and add a space after the "," since your definition uses "size_t", then use that rather than __kernel_size_t > --- a/lib/string.c > +++ b/lib/string.c > > +#ifndef __HAVE_ARCH_STRNDUP > +char * strndup(const char *s, size_t n) no space after that first "*" > + if ((s == NULL) || > + ((new = malloc (len + 1)) == NULL) ) { > + return NULL; > + } please split this up such as: if (s == NULL) return s; new = malloc(len + 1); if (new == NULL) return new; > + strncpy (new, s, len); no space before that "(" -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: