1 /* 2 * Copyright 2005, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 6 7 #include <SupportDefs.h> 8 9 #include <string.h> 10 11 12 void * 13 memccpy(void *_dest, const void *_source, int stopByte, size_t length) 14 { 15 if (length) { 16 const uint8 *source = (const uint8 *)_source; 17 uint8 *dest = (uint8 *)_dest; 18 19 do { 20 if ((*dest++ = *source++) == (uint8)stopByte) 21 return dest; 22 } while (--length != 0); 23 } 24 25 return NULL; 26 } 27 28