simplify/src/ModifySrc.cxx
//check whether this file is located in an include dir specified by -I
check whether this file is located in an include dir specified by -I
check whether this file is located in an include dir specified by - I
int TryIncludeDirs(string& str, const char* file)
{
  int ret = 0;
  int max_len = 0;
  int max_index = -1;
  int size = GetIncludeDirs().size();
  for (int i = 0; i < size; ++i)
    {
      const char* dir = GetIncludeDirs()[i];
      int len = strlen(dir);
      if (strncmp(dir, file, len) == 0)
        {
          if (len > max_len && file[len] == '/' || file[len] == '\\')
            {
              max_len = len;
              max_index = i;
            }
        }
    }
  if (max_index > -1)
    {
      const char* dir = GetIncludeDirs()[max_index];
      int len = strlen(dir);
      str = "<";
      str += file + len + 1;
      str += ">";
      ret = 1;
    }
  return ret;
}
int TryIncludeDirs ( string & str , const char * file ) { int ret = 0 ; int max_len = 0 ; int max_index = -1 ; int size = GetIncludeDirs ( ) . size ( ) ; for ( int i = 0 ; i < size ; ++ i ) { const char * dir = GetIncludeDirs ( ) [ i ] ; int len = strlen ( dir ) ; if ( strncmp ( dir , file , len ) == 0 ) { if ( len > max_len && file [ len ] == ' ' || file [ len ] == ' \\ ' ) { max_len = len ; max_index = i ; } } } if ( max_index > -1 ) { const char * dir = GetIncludeDirs ( ) [ max_index ] ; int len = strlen ( dir ) ; str = " " ; str += file + len + 1 ; str += " " ; ret = 1 ; } return ret ; }
check whether this file is located in an include dir specified by -I
check whether this file is located in an include dir specified by - I