strend.c
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:1k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*  File   : strend.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 23 April 1984
  4.     Defines: strend()
  5.     strend(s) returns a character pointer to the NUL which ends s.  That
  6.     is,  strend(s)-s  ==  strlen(s). This is useful for adding things at
  7.     the end of strings.  It is redundant, because  strchr(s,'')  could
  8.     be used instead, but this is clearer and faster.
  9.     Beware: the asm version works only if strlen(s) < 65535.
  10. */
  11. #include <global.h>
  12. #include "m_string.h"
  13. #if VaxAsm
  14. char *strend(s)
  15. const char *s;
  16. {
  17.   asm("locc $0,$65535,*4(ap)");
  18.   asm("movl r1,r0");
  19. }
  20. #else /* ~VaxAsm */
  21. char *strend(register const char *s)
  22. {
  23.   while (*s++);
  24.   return (char*) (s-1);
  25. }
  26. #endif /* VaxAsm */