[Verse-dev] profiling the server

Thorsten Jordan Thorsten_Jordan at gmx.de
Fri Oct 15 15:57:29 CEST 2004


Emil Brink schrieb:
> [all-bits-zero for floating point numbers] 
> 
> Not sure about strcpy() though, a buffer-limiting copy is probably good,
> I prefer using something like this over C's strncpy():
> 
> char * stu_strncpy(char *dest, size_t max, const char *src)
> {
> 	char	*base = dest;
> 	
> 	if(dest == NULL || src == NULL)
> 		return NULL;
> 	if(max == 0)
> 		return NULL;
> 	for(max--; max > 0 && *src != '\0'; max--)
> 		*dest++ = *src++;
> 	*dest = '\0';
> 
> 	return base;
> }
> 
> Since the standard strncpy() is so... Weird, heh.
where is the difference except you always put a 0 at the end of the string?

-- 
Greetings, Thorsten


More information about the Verse-dev mailing list