xref: /csrg-svn/lib/libc/string/memset.c (revision 41967)
1*41967Sbostic /*-
2*41967Sbostic  * Copyright (c) 1990 The Regents of the University of California.
334479Sbostic  * All rights reserved.
434479Sbostic  *
5*41967Sbostic  * This code is derived from software contributed to Berkeley by
6*41967Sbostic  * Chris Torek.
7*41967Sbostic  *
8*41967Sbostic  * %sccs.include.redist.c%
924197Skre  */
1024197Skre 
1126529Sdonn #if defined(LIBC_SCCS) && !defined(lint)
12*41967Sbostic static char sccsid[] = "@(#)memset.c	5.5 (Berkeley) 05/15/90";
1334479Sbostic #endif /* LIBC_SCCS and not lint */
1424197Skre 
15*41967Sbostic #include <string.h>
16*41967Sbostic #include <sys/stdc.h>
17*41967Sbostic 
18*41967Sbostic void *
19*41967Sbostic memset(dst, c, n)
20*41967Sbostic 	void *dst;
21*41967Sbostic 	register int c;
22*41967Sbostic 	register size_t n;
2324197Skre {
2424197Skre 
25*41967Sbostic 	if (n != 0) {
26*41967Sbostic 		register char *d = dst;
2724197Skre 
28*41967Sbostic 		do
29*41967Sbostic 			*d++ = c;
30*41967Sbostic 		while (--n != 0);
31*41967Sbostic 	}
32*41967Sbostic 	return (dst);
3324197Skre }
34