Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 7402be50..2187dca9 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -36,6 +34,7 @@
#include "alpm_list.h"
#include "util.h"
#include "log.h"
+#include "delta.h"
#include "trans.h"
#include "alpm.h"
@@ -44,6 +43,7 @@ alpm_handle_t *_alpm_handle_new(void)
alpm_handle_t *handle;
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
+ handle->deltaratio = 0.0;
return handle;
}
@@ -69,6 +69,8 @@ void _alpm_handle_free(alpm_handle_t *handle)
curl_easy_cleanup(handle->curl);
#endif
+ regfree(&handle->delta_regex);
+
/* free memory */
_alpm_trans_free(handle->trans);
FREE(handle->root);
@@ -251,10 +253,10 @@ const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle)
return handle->arch;
}
-int SYMEXPORT alpm_option_get_usedelta(alpm_handle_t *handle)
+double SYMEXPORT alpm_option_get_deltaratio(alpm_handle_t *handle)
{
CHECK_HANDLE(handle, return -1);
- return handle->usedelta;
+ return handle->deltaratio;
}
int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
@@ -339,7 +341,7 @@ static char *canonicalize_path(const char *path) {
return new_path;
}
-enum _alpm_errno_t _alpm_set_directory_option(const char *value,
+alpm_errno_t _alpm_set_directory_option(const char *value,
char **storage, int must_exist)
{
struct stat st;
@@ -596,10 +598,13 @@ int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
return 0;
}
-int SYMEXPORT alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta)
+int SYMEXPORT alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio)
{
CHECK_HANDLE(handle, return -1);
- handle->usedelta = usedelta;
+ if(ratio < 0.0 || ratio > 2.0) {
+ RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
+ }
+ handle->deltaratio = ratio;
return 0;
}