Restored work-around for hangs when trying to use disk-based handlers
[tangerine.git] / compiler / clib / bzero.c
blob29f4e1ad43e55eafc36ab1fa7d12ae91d12f6f16
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function bzero().
6 */
8 #include <proto/exec.h>
10 /*****************************************************************************
12 NAME */
13 #include <string.h>
15 void bzero (
17 /* SYNOPSIS */
18 void * ptr,
19 size_t len)
21 /* FUNCTION
22 Write len zero bytes to ptr. If len is zero, does nothing.
24 INPUTS
25 ptr - The first byte of the area in memory to be cleared.
26 len - How many bytes to clear.
28 RESULT
30 NOTES
32 EXAMPLE
34 BUGS
36 SEE ALSO
38 INTERNALS
40 ******************************************************************************/
42 UBYTE * bptr = ptr;
44 while (((IPTR)bptr)&(AROS_LONGALIGN-1) && len)
46 *bptr ++ = 0;
47 len --;
50 if (len > sizeof(ULONG))
52 ULONG * ulptr = (ULONG *)bptr;
54 while (len > sizeof(ULONG))
56 *ulptr ++ = 0UL;
57 len -= sizeof(ULONG);
60 bptr = (UBYTE *)ulptr;
63 while (len --)
64 *bptr ++ = 0;
66 } /* bzero */