1168400Skan/*-
2168400Skan * Copyright (C) 1992-2007 The FreeBSD Project. All rights reserved.
3168400Skan *
4168400Skan * Redistribution and use in source and binary forms, with or without
5168400Skan * modification, are permitted provided that the following conditions
6168400Skan * are met:
7168400Skan * 1. Redistributions of source code must retain the above copyright
8168400Skan *    notice, this list of conditions and the following disclaimer.
9168400Skan * 2. Redistributions in binary form must reproduce the above copyright
10168400Skan *    notice, this list of conditions and the following disclaimer in the
11168400Skan *    documentation and/or other materials provided with the distribution.
12168400Skan *
13168400Skan * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14168400Skan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15168400Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16168400Skan * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17168400Skan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18168400Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19168400Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20168400Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21168400Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22168400Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23168400Skan * SUCH DAMAGE.
24168400Skan */
25168400Skan#include <sys/cdefs.h>
26168400Skan__FBSDID("$FreeBSD$");
27168400Skan
28180514Sobrien#define	LIBKERN_INLINE
29168403Skan
30180514Sobrien#include <sys/types.h>
31180514Sobrien#include <sys/libkern.h>
32168403Skan
33168400Skanvoid *
34168400Skanmemset(void *b, int c, size_t len)
35168400Skan{
36168400Skan	char *bb;
37168400Skan
38180514Sobrien	if (c == 0)
39180514Sobrien		bzero(b, len);
40180514Sobrien	else
41180514Sobrien		for (bb = (char *)b; len--; )
42180514Sobrien			*bb++ = c;
43168400Skan	return (b);
44168400Skan}
45