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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [lib/] [strstr.c] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
extern void abort (void);
extern void abort (void);
extern int inside_main;
extern int inside_main;
 
 
char *
char *
strstr(const char *s1, const char *s2)
strstr(const char *s1, const char *s2)
{
{
  const char *p, *q;
  const char *p, *q;
 
 
#ifdef __OPTIMIZE__
#ifdef __OPTIMIZE__
  if (inside_main)
  if (inside_main)
    abort ();
    abort ();
#endif
#endif
 
 
  /* deliberately dumb algorithm */
  /* deliberately dumb algorithm */
  for (; *s1; s1++)
  for (; *s1; s1++)
    {
    {
      p = s1, q = s2;
      p = s1, q = s2;
      while (*q && *p)
      while (*q && *p)
        {
        {
          if (*q != *p)
          if (*q != *p)
            break;
            break;
          p++, q++;
          p++, q++;
        }
        }
      if (*q == 0)
      if (*q == 0)
        return (char *)s1;
        return (char *)s1;
    }
    }
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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