gnats-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to gnats/gnats/file-pr.c


From: Milan Zamazal
Subject: Changes to gnats/gnats/file-pr.c
Date: Sun, 10 Feb 2002 13:23:42 -0500

Index: gnats/gnats/file-pr.c
diff -c gnats/gnats/file-pr.c:1.44 gnats/gnats/file-pr.c:1.45
*** gnats/gnats/file-pr.c:1.44  Sun Dec 23 15:22:20 2001
--- gnats/gnats/file-pr.c       Sun Feb 10 13:23:42 2002
***************
*** 308,320 ****
        }
      }
  
!   /* XXX ??? !!! Do we want to do this always, or only if the state is
!      empty?  */
!   /* Make sure the PR is in the correct state. */
!   set_field (pr,
!            STATE (database), 
!            fieldDefForIndex(STATE (database))->default_value,
!            err);
  
    /* Retrieve a unique bug number.  */
    bug_number = getBugNumber (database, err);
--- 308,344 ----
        }
      }
  
!   {
!     /* Ensure the PR has a valid STATE.  We set the default state
!        on any of these cases:
!        
!          1. field_value() returns NULL.
!        
!        2. if field_value returns the default value.  (field_value in
!           4.0beta1 returns the default, even if it is not really set.)
! 
!        3. if set_field with the existing value fails.  If something
!           used set_field() previously, it was already validated,
!           but we call set_field to validate again to be sure.
!     */
!     char *val = (char *)field_value (pr, STATE (database));
!     char *default_val = fieldDefForIndex (STATE (database))->default_value;
!     
!     if (val != NULL)
!       {
!       val = xstrdup (val);
!       }
!     if (val == NULL
!       || ! strcmp (val, default_val)
!       || ! set_field (pr, STATE (database), val, err))
!       {
!       set_field (pr, STATE (database), default_val, err);
!       }
!     if (val != NULL)
!       {
!       free (val);
!       }
!   }
  
    /* Retrieve a unique bug number.  */
    bug_number = getBugNumber (database, err);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]