summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 13:15:43 -0500
committerDan McGee <dan@archlinux.org>2011-06-09 14:24:45 -0500
commit17a6ac567502975d3a98a34ed58d79c05eb7b8d1 (patch)
treefb764ae26aac86fd43daa79cb0047cc82f8039e9 /lib/libalpm/util.c
parent7968d30510de5a6031af39da498be5c821290b82 (diff)
downloadpacman-17a6ac567502975d3a98a34ed58d79c05eb7b8d1.tar.xz
Require handle argument to all alpm_option_(get|set)_*() methods
This requires a lot of line changes, but not many functional changes as more often than not our handle variable is already available in some fashion. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 68732d13..6b11c3a9 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -559,10 +559,11 @@ int _alpm_str_cmp(const void *s1, const void *s2)
}
/** Find a filename in a registered alpm cachedir.
+ * @param handle the context handle
* @param filename name of file to find
* @return malloced path of file, NULL if not found
*/
-char *_alpm_filecache_find(const char* filename)
+char *_alpm_filecache_find(pmhandle_t *handle, const char *filename)
{
char path[PATH_MAX];
char *retpath;
@@ -570,7 +571,7 @@ char *_alpm_filecache_find(const char* filename)
struct stat buf;
/* Loop through the cache dirs until we find a matching file */
- for(i = alpm_option_get_cachedirs(); i; i = alpm_list_next(i)) {
+ for(i = alpm_option_get_cachedirs(handle); i; i = alpm_list_next(i)) {
snprintf(path, PATH_MAX, "%s%s", (char *)alpm_list_getdata(i),
filename);
if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
@@ -585,16 +586,17 @@ char *_alpm_filecache_find(const char* filename)
/** Check the alpm cachedirs for existance and find a writable one.
* If no valid cache directory can be found, use /tmp.
+ * @param handle the context handle
* @return pointer to a writable cache directory.
*/
-const char *_alpm_filecache_setup(void)
+const char *_alpm_filecache_setup(pmhandle_t *handle)
{
struct stat buf;
alpm_list_t *i, *tmp;
char *cachedir;
/* Loop through the cache dirs until we find a writeable dir */
- for(i = alpm_option_get_cachedirs(); i; i = alpm_list_next(i)) {
+ for(i = alpm_option_get_cachedirs(handle); i; i = alpm_list_next(i)) {
cachedir = alpm_list_getdata(i);
if(stat(cachedir, &buf) != 0) {
/* cache directory does not exist.... try creating it */
@@ -614,7 +616,7 @@ const char *_alpm_filecache_setup(void)
/* we didn't find a valid cache directory. use /tmp. */
tmp = alpm_list_add(NULL, "/tmp/");
- alpm_option_set_cachedirs(tmp);
+ alpm_option_set_cachedirs(handle, tmp);
alpm_list_free(tmp);
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", "/tmp/");
_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n"));