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>
This commit is contained in:
parent
a888f377a5
commit
4da70d800a
|
@ -456,8 +456,8 @@ static int extract_single_file(struct archive *archive,
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_local = alpm_get_md5sum(filename);
|
hash_local = alpm_compute_md5sum(filename);
|
||||||
hash_pkg = alpm_get_md5sum(checkfile);
|
hash_pkg = alpm_compute_md5sum(checkfile);
|
||||||
|
|
||||||
/* append the new md5 hash to it's respective entry
|
/* append the new md5 hash to it's respective entry
|
||||||
* in newpkg's backup (it will be the new orginal) */
|
* 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);
|
_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));
|
MALLOC(backup, backup_len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
|
|
||||||
sprintf(backup, "%s\t%s", oldbackup, hash);
|
sprintf(backup, "%s\t%s", oldbackup, hash);
|
||||||
|
|
|
@ -435,7 +435,7 @@ const char *alpm_conflict_get_package2(pmconflict_t *conflict);
|
||||||
pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
|
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_name(const pmdepend_t *dep);
|
||||||
const char *alpm_dep_get_version(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
|
* File conflicts
|
||||||
|
@ -456,7 +456,7 @@ const char *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* checksums */
|
/* checksums */
|
||||||
char *alpm_get_md5sum(const char *name);
|
char *alpm_compute_md5sum(const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Errors
|
* Errors
|
||||||
|
|
|
@ -826,7 +826,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
if(info->depends) {
|
if(info->depends) {
|
||||||
fputs("%DEPENDS%\n", fp);
|
fputs("%DEPENDS%\n", fp);
|
||||||
for(lp = info->depends; lp; lp = lp->next) {
|
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);
|
fprintf(fp, "%s\n", depstring);
|
||||||
free(depstring);
|
free(depstring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
|
||||||
|
|
||||||
/* determine whether the delta file already exists */
|
/* determine whether the delta file already exists */
|
||||||
fpath = _alpm_filecache_find(vdelta->delta);
|
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) {
|
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
|
||||||
vdelta->download_size = 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 */
|
/* determine whether a base 'from' file exists */
|
||||||
fpath = _alpm_filecache_find(vdelta->from);
|
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) {
|
if(fpath && md5sum && strcmp(md5sum, vdelta->from_md5) == 0) {
|
||||||
v->weight = vdelta->download_size;
|
v->weight = vdelta->download_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
if(!_alpm_find_dep_satisfier(upgrade, depend) &&
|
if(!_alpm_find_dep_satisfier(upgrade, depend) &&
|
||||||
!_alpm_find_dep_satisfier(dblist, depend)) {
|
!_alpm_find_dep_satisfier(dblist, depend)) {
|
||||||
/* Unsatisfied dependency in the upgrade list */
|
/* 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",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(tp));
|
missdepstring, alpm_pkg_get_name(tp));
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
|
@ -293,7 +293,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
if(causingpkg &&
|
if(causingpkg &&
|
||||||
!_alpm_find_dep_satisfier(upgrade, depend) &&
|
!_alpm_find_dep_satisfier(upgrade, depend) &&
|
||||||
!_alpm_find_dep_satisfier(dblist, 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",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(lp));
|
missdepstring, alpm_pkg_get_name(lp));
|
||||||
free(missdepstring);
|
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);
|
pmpkg_t *spkg = _alpm_resolvedep(missdep, dbs_sync, list, tpkg);
|
||||||
if(!spkg) {
|
if(!spkg) {
|
||||||
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
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"),
|
_alpm_log(PM_LOG_ERROR, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||||
missdepstring, tpkg->name);
|
missdepstring, tpkg->name);
|
||||||
free(missdepstring);
|
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
|
* @param dep the depend to turn into a string
|
||||||
* @return a string-formatted dependency with operator if necessary
|
* @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;
|
char *name, *opr, *ver, *str = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
|
@ -550,7 +550,7 @@ int _alpm_lstat(const char *path, struct stat *buf)
|
||||||
* @return the checksum on success, NULL on error
|
* @return the checksum on success, NULL on error
|
||||||
* @addtogroup alpm_misc
|
* @addtogroup alpm_misc
|
||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_get_md5sum(const char *filename)
|
char SYMEXPORT *alpm_compute_md5sum(const char *filename)
|
||||||
{
|
{
|
||||||
unsigned char output[16];
|
unsigned char output[16];
|
||||||
char *md5sum;
|
char *md5sum;
|
||||||
|
@ -584,7 +584,7 @@ int _alpm_test_md5sum(const char *filepath, const char *md5sum)
|
||||||
char *md5sum2;
|
char *md5sum2;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
md5sum2 = alpm_get_md5sum(filepath);
|
md5sum2 = alpm_compute_md5sum(filepath);
|
||||||
|
|
||||||
if(md5sum == NULL || md5sum2 == NULL) {
|
if(md5sum == NULL || md5sum2 == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
|
@ -79,7 +79,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
|
||||||
/* turn depends list into a text list */
|
/* turn depends list into a text list */
|
||||||
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
||||||
pmdepend_t *dep = (pmdepend_t*)alpm_list_getdata(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) {
|
if(level>0) {
|
||||||
|
@ -176,7 +176,7 @@ void dump_pkg_backups(pmpkg_t *pkg)
|
||||||
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
||||||
/* if we find the file, calculate checksums, otherwise it is missing */
|
/* if we find the file, calculate checksums, otherwise it is missing */
|
||||||
if(access(path, R_OK) == 0) {
|
if(access(path, R_OK) == 0) {
|
||||||
char *md5sum = alpm_get_md5sum(path);
|
char *md5sum = alpm_compute_md5sum(path);
|
||||||
|
|
||||||
if(md5sum == NULL) {
|
if(md5sum == NULL) {
|
||||||
pm_fprintf(stderr, PM_LOG_ERROR,
|
pm_fprintf(stderr, PM_LOG_ERROR,
|
||||||
|
|
|
@ -107,7 +107,7 @@ int pacman_remove(alpm_list_t *targets)
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
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),
|
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
|
||||||
depstring);
|
depstring);
|
||||||
free(depstring);
|
free(depstring);
|
||||||
|
|
|
@ -640,7 +640,7 @@ static int sync_trans(alpm_list_t *targets)
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
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),
|
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
|
||||||
depstring);
|
depstring);
|
||||||
free(depstring);
|
free(depstring);
|
||||||
|
|
|
@ -90,7 +90,7 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
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:
|
/* TODO indicate if the error was a virtual package or not:
|
||||||
* :: %s: requires %s, provided by %s
|
* :: %s: requires %s, provided by %s
|
||||||
|
|
|
@ -105,7 +105,7 @@ int checkdeps(alpm_list_t *pkglist)
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
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),
|
printf("missing dependency for %s : %s\n", alpm_miss_get_target(miss),
|
||||||
depstring);
|
depstring);
|
||||||
free(depstring);
|
free(depstring);
|
||||||
|
|
Loading…
Reference in New Issue