From 4da70d800a25881f525498a451ae21b398a1d5b1 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Tue, 26 Aug 2008 12:57:08 +0200 Subject: 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 Signed-off-by: Dan McGee --- lib/libalpm/add.c | 6 +++--- lib/libalpm/alpm.h | 4 ++-- lib/libalpm/be_files.c | 2 +- lib/libalpm/delta.c | 4 ++-- lib/libalpm/deps.c | 8 ++++---- lib/libalpm/util.c | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3-24-g4f1b