1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate #include <k5-int.h> 7*7c478bd9Sstevel@tonic-gate 8*7c478bd9Sstevel@tonic-gate /* 9*7c478bd9Sstevel@tonic-gate * Note, there is no memset() in kernel land. This code is a replacement for 10*7c478bd9Sstevel@tonic-gate * use in the kerberos kernel mech. 11*7c478bd9Sstevel@tonic-gate * As a performance enhancement, bzero is called if the fill pattern is 0. 12*7c478bd9Sstevel@tonic-gate */ 13*7c478bd9Sstevel@tonic-gate void * krb5_memset(void * sp1,int c,size_t n)14*7c478bd9Sstevel@tonic-gatekrb5_memset(void *sp1, int c, size_t n) 15*7c478bd9Sstevel@tonic-gate { 16*7c478bd9Sstevel@tonic-gate if (n > 0) { 17*7c478bd9Sstevel@tonic-gate if (c == 0) { 18*7c478bd9Sstevel@tonic-gate bzero(sp1, n); 19*7c478bd9Sstevel@tonic-gate } else { 20*7c478bd9Sstevel@tonic-gate unsigned char *sp = sp1; 21*7c478bd9Sstevel@tonic-gate do { 22*7c478bd9Sstevel@tonic-gate *sp++ = (unsigned char)c; 23*7c478bd9Sstevel@tonic-gate } while (--n != 0); 24*7c478bd9Sstevel@tonic-gate } 25*7c478bd9Sstevel@tonic-gate } 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate return (sp1); 28*7c478bd9Sstevel@tonic-gate } 29