bzero.c 575 B

12345678910111213141516171819202122232425262728293031
  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. void attribute_hidden __bzero(void *s, size_t n)
  9. {
  10. #if 1
  11. (void)__memset(s, 0, n);
  12. #else
  13. register unsigned char *p = s;
  14. #ifdef __BCC__
  15. /* bcc can optimize the counter if it thinks it is a pointer... */
  16. register const char *np = (const char *) n;
  17. #else
  18. #define np n
  19. #endif
  20. while (np) {
  21. *p++ = 0;
  22. --np;
  23. }
  24. #endif
  25. }
  26. #undef np
  27. strong_alias(__bzero,bzero)