OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [lib/] [strstr.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
extern void abort (void);
2
extern int inside_main;
3
 
4
__attribute__ ((__noinline__))
5
char *
6
strstr(const char *s1, const char *s2)
7
{
8
  const char *p, *q;
9
 
10
#ifdef __OPTIMIZE__
11
  if (inside_main)
12
    abort ();
13
#endif
14
 
15
  /* deliberately dumb algorithm */
16
  for (; *s1; s1++)
17
    {
18
      p = s1, q = s2;
19
      while (*q && *p)
20
        {
21
          if (*q != *p)
22
            break;
23
          p++, q++;
24
        }
25
      if (*q == 0)
26
        return (char *)s1;
27
    }
28
  return 0;
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.