gnats/gnats adm.c edit.c file-pr.c gnats.h gnat...

Mel Hatzis <[email protected]> Thu, 24 Feb 2005 14:21:12 -0500
Newsgroups gmane.comp.bug-tracking.gnats.cvs
Message-ID <E1D4OXw-0005wJ-00@savannah>
CVSROOT:	/cvsroot/gnats
Module name:	gnats
Branch: 	
Changes by:	Mel Hatzis <[email protected]>	05/02/24 19:21:12

Modified files:
	gnats          : adm.c edit.c file-pr.c gnats.h gnatsd.c index.c 
	                 index.h mail.c pr.c pr.h 

Log message:
	* adm.c (copy_adm_entry): Handle blank metadata fields by correctly
	assigning the relevant field in the adm struct to NULL - and thereby
	avoid an attempt to xstrdup a NULL value.
	
	* file-pr.c (createNewPRFile): Avoid a NULL pointer dereference when
	there's a blank response time field in the submitters file.
	
	* gnatsd.c (findUserAccessLevel): Avoid a strlen of NULL when the
	gnatsd.user_access file contains a blank 'database-alias' field.
	
	* gnats.h (rewrite_pr): Made it a static function in edit.c - it
	wasn't being used outside this scope anyway.
	
	* mail.c (get_responsible_address): Avoid a NULL pointer dereference
	if the responsible file doesn't have an email address for the
	gnats-admin user.
	
	* index.c, index.h (getPrevPR, setPrevPR, setNextPR): New functions.
	The index chain is now doubly linked allowing edited PRs to be
	replaced without incurring the overhead of a search through the
	chain. As well as offering significantly better performance, this
	supports a change to the PR edit functionality whereby we now start
	with a copy of the old PR as well as the updated PR instead of
	retrieving the old PR (from the index) in the guts of rewrite_pr.
	The motivation behind this change is to isolate the index
	functionality and move toward a generic backend datastore which
	doesn't require the index.
	(replaceCurrentPRInIndex): Modified signature. Pass in the PR to be
	replaced (as well as the new PR) since we can now use the doubly
	linked index chain to replace the PR without searching for it.
	
	* pr.h (lookup_pr_path): Removed. Replaced by a call to the new
	get_pr_from_index () function followed by a call to (a modified)
	get_pr_path (). This change allows a single index search to be done
	once (early on in a given call stack) to retrieve a PR and
	thereafter access the PR file without requiring  more index
	searches.
	(pr_delete): New function. Contains the flat-file specific logic
	related to PR deletions which will be moved out into a flat-file
	backend when the datastore backend is generalized.
	
	* pr.c (get_pr_from_index): New function. Retrieve a PR from the
	index.
	(pr_file_readable): New function. Check if a file can be opened for
	reading.
	(pr_delete): New function. Flat-file specific logic for delete.
	(prExists): Now utilize get_pr_from_index () and get_pr_path ()
	instead of the deprecated lookup_pr_path ().
	(readPRWithNum): Ditto. Also set the PR's next/prev index pointers.
	(get_pr_path): New signature. Take in a PR * instead of searching
	the index.
	(lookup_pr_path): Deprecated.
	
	* edit.c (applyChangeActions, processFieldChange, sendAuditMail):
	Repositioned within the file so as not to require prototypes.
	(processPRChanges): Handle NULL values appropriately when undoing
	changes to modified read-only fields.
	(rewrite_pr, replace_pr, edit_field): rewrite_pr now takes in a copy
	of the old pr instead of retrieving it from the index. This is in
	preparation for allowing it to be used with more than just the flat
	file backend datastore. Also moved some error checking out of
	rewrite_pr and simplified it...no need to validate the whole PR
	when editing a single field.
	(deletePR): Moved the file-related logic into a new pr_delete function
	inside pr.c thereby preparing for a general backend datastore.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/adm.c.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/edit.c.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/file-pr.c.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/gnats.h.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/gnatsd.c.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/index.c.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/index.h.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/mail.c.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/pr.c.diff?tr1=1.64&tr2=1.65&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnats/gnats/gnats/pr.h.diff?tr1=1.38&tr2=1.39&r1=text&r2=text