summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2008-08-26 12:57:08 +0200
committerDan McGee <dan@archlinux.org>2009-01-13 06:59:30 +0100
commit4da70d800a25881f525498a451ae21b398a1d5b1 (patch)
tree6c3446c1ec32e5f8a8acd28d1b0b6bb82684eef7
parenta888f377a5c805f1da24b556e6a4a9e3678d8eb3 (diff)
downloadpacman-4da70d800a25881f525498a451ae21b398a1d5b1.tar.gz
pacman-4da70d800a25881f525498a451ae21b398a1d5b1.tar.xz
Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to alpm_dep_compute_string
This patch introduces the following function name convention: _compute_ in function name: the return value must be freed. _get_ in function name: the return value must not be freed. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/add.c6
-rw-r--r--lib/libalpm/alpm.h4
-rw-r--r--lib/libalpm/be_files.c2
-rw-r--r--lib/libalpm/delta.c4
-rw-r--r--lib/libalpm/deps.c8
-rw-r--r--lib/libalpm/util.c4
-rw-r--r--src/pacman/package.c4
-rw-r--r--src/pacman/remove.c2
-rw-r--r--src/pacman/sync.c2
-rw-r--r--src/pacman/upgrade.c2
-rw-r--r--src/util/testdb.c2
11 files changed, 20 insertions, 20 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index b0a7671b..264a28ee 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -456,8 +456,8 @@ static int extract_single_file(struct archive *archive,
return(1);
}
- hash_local = alpm_get_md5sum(filename);
- hash_pkg = alpm_get_md5sum(checkfile);
+ hash_local = alpm_compute_md5sum(filename);
+ hash_pkg = alpm_compute_md5sum(checkfile);
/* append the new md5 hash to it's respective entry
* in newpkg's backup (it will be the new orginal) */
@@ -618,7 +618,7 @@ static int extract_single_file(struct archive *archive,
}
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s\n", filename);
- hash = alpm_get_md5sum(filename);
+ hash = alpm_compute_md5sum(filename);
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(backup, "%s\t%s", oldbackup, hash);
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index ecce02f9..7b7ca4e7 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -435,7 +435,7 @@ const char *alpm_conflict_get_package2(pmconflict_t *conflict);
pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
const char *alpm_dep_get_name(const pmdepend_t *dep);
const char *alpm_dep_get_version(const pmdepend_t *dep);
-char *alpm_dep_get_string(const pmdepend_t *dep);
+char *alpm_dep_compute_string(const pmdepend_t *dep);
/*
* File conflicts
@@ -456,7 +456,7 @@ const char *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict);
*/
/* checksums */
-char *alpm_get_md5sum(const char *name);
+char *alpm_compute_md5sum(const char *name);
/*
* Errors
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 31b23172..de906eb7 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -826,7 +826,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(info->depends) {
fputs("%DEPENDS%\n", fp);
for(lp = info->depends; lp; lp = lp->next) {
- char *depstring = alpm_dep_get_string(lp->data);
+ char *depstring = alpm_dep_compute_string(lp->data);
fprintf(fp, "%s\n", depstring);
free(depstring);
}
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 8dce7e3b..ff77501e 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -95,7 +95,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
/* determine whether the delta file already exists */
fpath = _alpm_filecache_find(vdelta->delta);
- md5sum = alpm_get_md5sum(fpath);
+ md5sum = alpm_compute_md5sum(fpath);
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
vdelta->download_size = 0;
}
@@ -104,7 +104,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
/* determine whether a base 'from' file exists */
fpath = _alpm_filecache_find(vdelta->from);
- md5sum = alpm_get_md5sum(fpath);
+ md5sum = alpm_compute_md5sum(fpath);
if(fpath && md5sum && strcmp(md5sum, vdelta->from_md5) == 0) {
v->weight = vdelta->download_size;
}
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 96c971a2..940f12ce 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -269,7 +269,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
if(!_alpm_find_dep_satisfier(upgrade, depend) &&
!_alpm_find_dep_satisfier(dblist, depend)) {
/* Unsatisfied dependency in the upgrade list */
- char *missdepstring = alpm_dep_get_string(depend);
+ char *missdepstring = alpm_dep_compute_string(depend);
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
missdepstring, alpm_pkg_get_name(tp));
free(missdepstring);
@@ -293,7 +293,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
if(causingpkg &&
!_alpm_find_dep_satisfier(upgrade, depend) &&
!_alpm_find_dep_satisfier(dblist, depend)) {
- char *missdepstring = alpm_dep_get_string(depend);
+ char *missdepstring = alpm_dep_compute_string(depend);
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
missdepstring, alpm_pkg_get_name(lp));
free(missdepstring);
@@ -581,7 +581,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, alpm_list_t *list,
pmpkg_t *spkg = _alpm_resolvedep(missdep, dbs_sync, list, tpkg);
if(!spkg) {
pm_errno = PM_ERR_UNSATISFIED_DEPS;
- char *missdepstring = alpm_dep_get_string(missdep);
+ char *missdepstring = alpm_dep_compute_string(missdep);
_alpm_log(PM_LOG_ERROR, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
missdepstring, tpkg->name);
free(missdepstring);
@@ -685,7 +685,7 @@ const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
* @param dep the depend to turn into a string
* @return a string-formatted dependency with operator if necessary
*/
-char SYMEXPORT *alpm_dep_get_string(const pmdepend_t *dep)
+char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
{
char *name, *opr, *ver, *str = NULL;
size_t len;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 4d682552..5e6ca0c0 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -550,7 +550,7 @@ int _alpm_lstat(const char *path, struct stat *buf)
* @return the checksum on success, NULL on error
* @addtogroup alpm_misc
*/
-char SYMEXPORT *alpm_get_md5sum(const char *filename)
+char SYMEXPORT *alpm_compute_md5sum(const char *filename)
{
unsigned char output[16];
char *md5sum;
@@ -584,7 +584,7 @@ int _alpm_test_md5sum(const char *filepath, const char *md5sum)
char *md5sum2;
int ret;
- md5sum2 = alpm_get_md5sum(filepath);
+ md5sum2 = alpm_compute_md5sum(filepath);
if(md5sum == NULL || md5sum2 == NULL) {
ret = -1;
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 71be2d8c..b23c577f 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -79,7 +79,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
/* turn depends list into a text list */
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
pmdepend_t *dep = (pmdepend_t*)alpm_list_getdata(i);
- depstrings = alpm_list_add(depstrings, alpm_dep_get_string(dep));
+ depstrings = alpm_list_add(depstrings, alpm_dep_compute_string(dep));
}
if(level>0) {
@@ -176,7 +176,7 @@ void dump_pkg_backups(pmpkg_t *pkg)
snprintf(path, PATH_MAX-1, "%s%s", root, str);
/* if we find the file, calculate checksums, otherwise it is missing */
if(access(path, R_OK) == 0) {
- char *md5sum = alpm_get_md5sum(path);
+ char *md5sum = alpm_compute_md5sum(path);
if(md5sum == NULL) {
pm_fprintf(stderr, PM_LOG_ERROR,
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 841a08bb..11bc157f 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -107,7 +107,7 @@ int pacman_remove(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
- char *depstring = alpm_dep_get_string(dep);
+ char *depstring = alpm_dep_compute_string(dep);
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
depstring);
free(depstring);
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index e3a772de..d8a63481 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -640,7 +640,7 @@ static int sync_trans(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
- char *depstring = alpm_dep_get_string(dep);
+ char *depstring = alpm_dep_compute_string(dep);
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
depstring);
free(depstring);
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index c54b3ed7..2c996883 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -90,7 +90,7 @@ int pacman_upgrade(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
- char *depstring = alpm_dep_get_string(dep);
+ char *depstring = alpm_dep_compute_string(dep);
/* TODO indicate if the error was a virtual package or not:
* :: %s: requires %s, provided by %s
diff --git a/src/util/testdb.c b/src/util/testdb.c
index 8a66819f..cbff5784 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -105,7 +105,7 @@ int checkdeps(alpm_list_t *pkglist)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
pmdepend_t *dep = alpm_miss_get_dep(miss);
- char *depstring = alpm_dep_get_string(dep);
+ char *depstring = alpm_dep_compute_string(dep);
printf("missing dependency for %s : %s\n", alpm_miss_get_target(miss),
depstring);
free(depstring);