Commits

BarryFSmith  committed b3bf12d

*** empty log message ***

  • Participants
  • Parent commits ced274b

Comments (0)

Files changed (1)

File src/sys/src/objects/options.c

-/*$Id: options.c,v 1.245 2001/03/09 17:20:59 balay Exp balay $*/
+/*$Id: options.c,v 1.246 2001/03/23 23:20:38 balay Exp bsmith $*/
 /*
    These routines simplify the use of command line, file options, etc.,
    and are used to manipulate the options database.
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidIntPointer(ivalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (flag) {
     if (!value) {if (flg) *flg = PETSC_FALSE; *ivalue = 0;}
   int        ierr;
 
   PetscFunctionBegin;
+  PetscValidIntPointer(ivalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (flag) {
     if (flg) *flg = PETSC_TRUE;
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidDoublePointer(dvalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (flag) {
     if (!value) {if (flg) *flg = PETSC_FALSE; *dvalue = 0.0;}
   int        ierr;
   
   PetscFunctionBegin;
+  PetscValidScalarPointer(dvalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (flag) {
     if (!value) {
 @*/
 int PetscOptionsGetDoubleArray(const char pre[],const char name[],double dvalue[],int *nmax,PetscTruth *flg)
 {
-  char       *value,*cpy;
+  char       *value;
   int        n = 0,ierr;
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidDoublePointer(dvalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (!flag)  {if (flg) *flg = PETSC_FALSE; *nmax = 0; PetscFunctionReturn(0);}
   if (!value) {if (flg) *flg = PETSC_TRUE; *nmax = 0; PetscFunctionReturn(0);}
 
   if (flg) *flg = PETSC_TRUE;
-  /* make a copy of the values, otherwise we destroy the old values */
-  ierr  = PetscStrallocpy(value,&cpy);CHKERRQ(ierr);
-  value = cpy;
 
   ierr = PetscStrtok(value,",",&value);CHKERRQ(ierr);
   while (n < *nmax) {
     n++;
   }
   *nmax = n;
-  ierr = PetscFree(cpy);CHKERRQ(ierr);
   PetscFunctionReturn(0); 
 } 
 
 @*/
 int PetscOptionsGetIntArray(const char pre[],const char name[],int dvalue[],int *nmax,PetscTruth *flg)
 {
-  char       *value,*cpy;
+  char       *value;
   int        n = 0,ierr;
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidIntPointer(dvalue);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr);
   if (!flag)  {if (flg) *flg = PETSC_FALSE; *nmax = 0; PetscFunctionReturn(0);}
   if (!value) {if (flg) *flg = PETSC_TRUE; *nmax = 0; PetscFunctionReturn(0);}
 
   if (flg) *flg = PETSC_TRUE;
-  /* make a copy of the values, otherwise we destroy the old values */
-  ierr  = PetscStrallocpy(value,&cpy);CHKERRQ(ierr);
-  value = cpy;
 
   ierr = PetscStrtok(value,",",&value);CHKERRQ(ierr);
   while (n < *nmax) {
     n++;
   }
   *nmax = n;
-  ierr = PetscFree(cpy);CHKERRQ(ierr);
   PetscFunctionReturn(0); 
 } 
 
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidCharPointer(string);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr); 
   if (!flag) {
     if (flg) *flg = PETSC_FALSE;
 @*/
 int PetscOptionsGetStringArray(const char pre[],const char name[],char **strings,int *nmax,PetscTruth *flg)
 {
-  char       *value,*cpy;
+  char       *value;
   int        len,n,ierr;
   PetscTruth flag;
 
   PetscFunctionBegin;
+  PetscValidPointer(strings);
   ierr = PetscOptionsFindPair_Private(pre,name,&value,&flag);CHKERRQ(ierr); 
   if (!flag)  {*nmax = 0; if (flg) *flg = PETSC_FALSE; PetscFunctionReturn(0);}
   if (!value) {*nmax = 0; if (flg) *flg = PETSC_FALSE;PetscFunctionReturn(0);}
   if (!*nmax) {if (flg) *flg = PETSC_FALSE;PetscFunctionReturn(0);}
   if (flg) *flg = PETSC_TRUE;
 
-  /* make a copy of the values, otherwise we destroy the old values */
-  ierr  = PetscStrallocpy(value,&cpy);CHKERRQ(ierr);
-  value = cpy;
-
   ierr = PetscStrtok(value,",",&value);CHKERRQ(ierr);
   n = 0;
   while (n < *nmax) {
     n++;
   }
   *nmax = n;
-  ierr = PetscFree(cpy);CHKERRQ(ierr);
   PetscFunctionReturn(0); 
 }