bzero.c 565 B

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