xbps_repo_close: only unlock the file lock if repo was opened as such.

If xbps_repo_open() was called with the lock arg set, xbps_repo_close()
will now unlock the repo file lock, without the need to set it.

This avoids the need to always unlock the file lock even if it wasn't
locked previously. This also introduceds an ABI/API break, but this
way it's cleaner.
This commit is contained in:
Juan RP
2015-01-11 09:11:38 +01:00
parent 9aaff4e2d0
commit b23855f692
7 changed files with 18 additions and 16 deletions

View File

@@ -48,7 +48,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20150110-1"
#define XBPS_API_VERSION "20150111"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@@ -1257,6 +1257,7 @@ struct xbps_repo {
* @private
*/
int fd;
bool is_locked;
/**
* var is_remote
*
@@ -1418,9 +1419,8 @@ struct xbps_repo *xbps_repo_open(struct xbps_handle *xhp, const char *url, bool
* Closes a repository object and releases resources.
*
* @param[in] repo The repository object to close.
* @param[in] lock Set it to true to release the POSIX file lock.
*/
void xbps_repo_close(struct xbps_repo *repo, bool lock);
void xbps_repo_close(struct xbps_repo *repo);
/**
*