(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
builtins/
lib/
strstr.c
       1  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  }