repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git]
/
gcc
/
testsuite
/
gcc.c-torture
/
execute
/
builtins
/
lib
/
strstr.c
blob
737a48f63dcdb935338b4fc816c49d2fb1ae9f41
1
extern
int
inside_main
;
2
3
char
*
4
strstr
(
const char
*
s1
,
const char
*
s2
)
5
{
6
const char
*
p
, *
q
;
7
8
#ifdef __OPTIMIZE__
9
if
(
inside_main
)
10
abort
();
11
#endif
12
13
/* deliberately dumb algorithm */
14
for
(; *
s1
;
s1
++)
15
{
16
p
=
s1
,
q
=
s2
;
17
while
(*
q
&& *
p
)
18
{
19
if
(*
q
!= *
p
)
20
break
;
21
p
++,
q
++;
22
}
23
if
(*
q
==
0
)
24
return
(
char
*)
s1
;
25
}
26
return
0
;
27
}