This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] string: add GNU basename(3)


On 13 Mar 2015 11:25, Yaakov Selkowitz wrote:
> +char* 

pretty sure newlib follows GNU style which means this code needs a bit of work

space before the * here

> +	if( path == NULL || *path == '\0' )

spacing is wrong:
	if (path == NULL || *path == '\0')

> +	p = (char *)path + strlen(path) - 1;

i would mark p const and delay the cast to the return

space for func calls though:
	... + strlen (path) ...

> +	if( *p == '/' )

bad spacing

> +	while( p >= path && *p != '/' )

bad spacing

> +		p--;
> +	return p + 1;

there should be a newline before the return
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]