Make some reorganization in struct xbps_handle.

The variables to set cachedir, rootdir and metadir have been
changed to "array of chars", this way there are no extra allocations.

Update clients accordingly and bump API version.
This commit is contained in:
Juan RP
2013-12-16 11:46:39 +01:00
parent 2c16e23646
commit 2a21354a1c
10 changed files with 107 additions and 110 deletions

View File

@ -29,6 +29,7 @@
#include <stdio.h>
#include <inttypes.h>
#include <limits.h>
#include <xbps/xbps_array.h>
#include <xbps/xbps_bool.h>
@ -46,7 +47,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20131216-1"
#define XBPS_API_VERSION "20131216-2"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@ -529,27 +530,6 @@ struct xbps_handle {
* the \a xbps_fetch_cb function callback.
*/
void *fetch_cb_data;
/**
* @var rootdir
*
* Root directory for all operations in XBPS. If NULL,
* by default it's set to /.
*/
const char *rootdir;
/**
* @var cachedir
*
* Cache directory to store downloaded binary packages.
* If NULL default value in \a XBPS_CACHE_PATH is used.
*/
const char *cachedir;
/**
* @var metadir
*
* Metadata directory for all operations in XBPS.
* If NULL, defaults to \a XBPS_CACHE_PATH (relative to rootdir).
*/
const char *metadir;
/**
* @var conffile
*
@ -557,12 +537,38 @@ struct xbps_handle {
*/
const char *conffile;
/**
* @private
* @var target_arch
*
* Target architecture, as set by XBPS_TARGET_ARCH from environment.
*/
char *cachedir_priv;
char *metadir_priv;
char *native_arch;
const char *target_arch;
/**
* @var rootdir
*
* Root directory for all operations in XBPS.
* If unset, defaults to '/'.
*/
char rootdir[PATH_MAX-1];
/**
* @var cachedir
*
* Cache directory to store downloaded binary packages.
* If unset, defaults to \a XBPS_CACHE_PATH (relative to rootdir).
*/
char cachedir[PATH_MAX-1];
/**
* @var metadir
*
* Metadata directory for all operations in XBPS.
* If unset, defaults to \a XBPS_CACHE_PATH (relative to rootdir).
*/
char metadir[PATH_MAX-1];
/**
* @var native_arch
*
* Machine architecture, as returned by uname(2)::machine.
*/
char native_arch[16];
/**
* @var fetch_timeout
*

View File

@ -45,6 +45,7 @@
#include "queue.h"
#include "fetch.h"
#include "compat.h"
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
ARCHIVE_EXTRACT_SECURE_SYMLINKS