diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-06 02:10:30 +0100 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-06 02:10:30 +0100 |
commit | 8fea5ca7104c0d95108947661a4991b61b2ee06e (patch) | |
tree | 7ad44a658a61d4a8dfb43ca5b6122c5626f68ea0 /lib/qpselect.c | |
parent | c933cf7233f51f677ab01689f175ceb3dc5361f6 (diff) | |
download | quagga-8fea5ca7104c0d95108947661a4991b61b2ee06e.tar.bz2 quagga-8fea5ca7104c0d95108947661a4991b61b2ee06e.tar.xz |
First beta release
Various bug fixes and improvements.
Running with a fair amount of debug/assert code, which must be
removed at some date.
Diffstat (limited to 'lib/qpselect.c')
-rw-r--r-- | lib/qpselect.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/qpselect.c b/lib/qpselect.c index 882f4173..3cca3805 100644 --- a/lib/qpselect.c +++ b/lib/qpselect.c @@ -503,17 +503,32 @@ qps_file_init_new(qps_file qf, qps_file template) } ; /*------------------------------------------------------------------------------ - * Free dynamically allocated qps_file structure. + * Free dynamically allocated qps_file structure -- if any. * - * It is the caller's responsibility to have removed it from any selection it - * may have been in. + * Removes from any selection may be a member of. + * + * If there is a valid fd -- close it ! + * + * Returns: NULL */ -void +extern qps_file qps_file_free(qps_file qf) { - assert(qf->selection == NULL) ; /* Mustn't be a selection member ! */ + if (qf != NULL) + { + if (qf->selection != NULL) + qps_remove_file(qf) ; + + if (qf->fd >= 0) + { + close(qf->fd) ; + qf->fd = fd_undef ; + } ; + + XFREE(MTYPE_QPS_FILE, qf) ; + } ; - XFREE(MTYPE_QPS_FILE, qf) ; + return NULL ; } ; /*------------------------------------------------------------------------------ @@ -574,7 +589,7 @@ qps_set_action(qps_file qf, qps_mnum_t mnum, qps_action* action) /*------------------------------------------------------------------------------ * Disable file for one or more modes. * - * If there are any pending pending results for the modes, those are discarded. + * If there are any pending results for the modes, those are discarded. * * Note that this is modestly "optimised" to deal with disabling a single mode. * (Much of the time only the write mode will be being disabled !) |