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