You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

26 years ago
26 years ago
  1. /* Copyright (C) 2002 MySQL AB
  2. This library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Library General Public
  4. License as published by the Free Software Foundation; version 2
  5. of the License.
  6. This library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Library General Public License for more details.
  10. You should have received a copy of the GNU Library General Public
  11. License along with this library; if not, write to the Free
  12. Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  13. MA 02111-1307, USA */
  14. /* File : strend.c
  15. Author : Richard A. O'Keefe.
  16. Updated: 23 April 1984
  17. Defines: strend()
  18. strend(s) returns a character pointer to the NUL which ends s. That
  19. is, strend(s)-s == strlen(s). This is useful for adding things at
  20. the end of strings. It is redundant, because strchr(s,'\0') could
  21. be used instead, but this is clearer and faster.
  22. Beware: the asm version works only if strlen(s) < 65535.
  23. */
  24. #include <my_global.h>
  25. #include "m_string.h"
  26. #if VaxAsm
  27. char *strend(s)
  28. const char *s;
  29. {
  30. asm("locc $0,$65535,*4(ap)");
  31. asm("movl r1,r0");
  32. }
  33. #else /* ~VaxAsm */
  34. char *strend(register const char *s)
  35. {
  36. while (*s++);
  37. return (char*) (s-1);
  38. }
  39. #endif /* VaxAsm */