bzero.c 618 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include "_string.h"
  8. #ifdef __UCLIBC_SUSV3_LEGACY__
  9. /* Experimentally off - libc_hidden_proto(memset) */
  10. void bzero(void *s, size_t n)
  11. {
  12. #if 1
  13. (void)memset(s, 0, n);
  14. #else
  15. register unsigned char *p = s;
  16. #ifdef __BCC__
  17. /* bcc can optimize the counter if it thinks it is a pointer... */
  18. register const char *np = (const char *) n;
  19. #else
  20. #define np n
  21. #endif
  22. while (np) {
  23. *p++ = 0;
  24. --np;
  25. }
  26. #endif
  27. }
  28. #undef np
  29. #endif