Commits

BarryFSmith committed d9f2732 Merge

Merge branch 'barry/rm-strncmp'

Comments (0)

Files changed (1)

src/sys/objects/options.c

 @*/
 PetscErrorCode  PetscOptionsValidKey(const char in_str[],PetscBool  *key)
 {
+  PetscBool      inf,INF;
+  PetscErrorCode ierr;
+
   PetscFunctionBegin;
   *key = PETSC_FALSE;
   if (!in_str) PetscFunctionReturn(0);
   if (in_str[0] != '-') PetscFunctionReturn(0);
   if (in_str[1] == '-') in_str++;
   if (!isalpha(in_str[1])) PetscFunctionReturn(0);
-  if ((!strncmp(in_str+1,"inf",3) || !strncmp(in_str+1,"INF",3)) && !(in_str[4] == '_' || isalnum(in_str[4]))) PetscFunctionReturn(0);
+  ierr = PetscStrncmp(in_str+1,"inf",3,&inf);CHKERRQ(ierr);
+  ierr = PetscStrncmp(in_str+1,"INF",3,&INF);CHKERRQ(ierr);
+  if ((inf || INF) && !(in_str[4] == '_' || isalnum(in_str[4]))) PetscFunctionReturn(0);
   *key = PETSC_TRUE;
   PetscFunctionReturn(0);
 }