FreeBSD/contrib/gcclibs/libgomp/env.c
/* Parse the OMP_SCHEDULE environment variable.  */
Parse the OMP_SCHEDULE environment variable.
Parse the OMP_SCHEDULE environment variable .
static void
parse_schedule (void)
{
  char *env, *end;
  unsigned long value;
  env = getenv ("OMP_SCHEDULE");
  if (env == NULL)
    return;
  while (isspace ((unsigned char) *env))
    ++env;
  if (strncasecmp (env, "static", 6) == 0)
    {
      gomp_run_sched_var = GFS_STATIC;
      env += 6;
    }
  else if (strncasecmp (env, "dynamic", 7) == 0)
    {
      gomp_run_sched_var = GFS_DYNAMIC;
      env += 7;
    }
  else if (strncasecmp (env, "guided", 6) == 0)
    {
      gomp_run_sched_var = GFS_GUIDED;
      env += 6;
    }
  else
    goto unknown;
  while (isspace ((unsigned char) *env))
    ++env;
  if (*env == '\0')
    return;
  if (*env++ != ',')
    goto unknown;
  while (isspace ((unsigned char) *env))
    ++env;
  if (*env == '\0')
    goto invalid;
  errno = 0;
  value = strtoul (env, &end, 10);
  if (errno)
    goto invalid;
  while (isspace ((unsigned char) *end))
    ++end;
  if (*end != '\0')
    goto invalid;
  gomp_run_sched_chunk = value;
  return;
 unknown:
  gomp_error ("Unknown value for environment variable OMP_SCHEDULE");
  return;
 invalid:
  gomp_error ("Invalid value for chunk size in "
	      "environment variable OMP_SCHEDULE");
  return;
}
static void parse_schedule ( void ) { char * env , * end ; unsigned long value ; env = getenv ( " " ) ; if ( env == NULL ) return ; while ( isspace ( ( unsigned char ) * env ) ) ++ env ; if ( strncasecmp ( env , " " , 6 ) == 0 ) { gomp_run_sched_var = GFS_STATIC ; env += 6 ; } else if ( strncasecmp ( env , " " , 7 ) == 0 ) { gomp_run_sched_var = GFS_DYNAMIC ; env += 7 ; } else if ( strncasecmp ( env , " " , 6 ) == 0 ) { gomp_run_sched_var = GFS_GUIDED ; env += 6 ; } else goto unknown ; while ( isspace ( ( unsigned char ) * env ) ) ++ env ; if ( * env == ' \0 ' ) return ; if ( * env ++ != ' ' ) goto unknown ; while ( isspace ( ( unsigned char ) * env ) ) ++ env ; if ( * env == ' \0 ' ) goto invalid ; errno = 0 ; value = strtoul ( env , & end , 10 ) ; if ( errno ) goto invalid ; while ( isspace ( ( unsigned char ) * end ) ) ++ end ; if ( * end != ' \0 ' ) goto invalid ; gomp_run_sched_chunk = value ; return ; unknown : gomp_error ( " " ) ; return ; invalid : gomp_error ( " " " " ) ; return ; }
Parse the OMP_SCHEDULE environment variable.
Parse the OMP_SCHEDULE environment variable .