From 09f29f706df0cf171ba7e7e8a3272388039630e4 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 12 Jul 2011 14:08:07 +0200 Subject: [PATCH] - rename all sat_ to solv_ --- CMakeLists.txt | 2 +- bindings/solv.i | 138 ++++++------ examples/solv.c | 140 ++++++------- ext/CMakeLists.txt | 4 +- ext/libsolvext.ver | 4 +- ext/pool_fileconflicts.c | 56 ++--- ext/repo_content.c | 32 +-- ext/repo_deb.c | 38 ++-- ext/repo_deltainfoxml.c | 26 +-- ext/repo_helix.c | 10 +- ext/repo_products.c | 22 +- ext/repo_repomdxml.c | 6 +- ext/repo_rpmdb.c | 334 +++++++++++++++--------------- ext/repo_rpmmd.c | 40 ++-- ext/repo_susetags.c | 50 ++--- ext/repo_updateinfoxml.c | 2 +- ext/repo_write.c | 94 ++++----- ext/repo_zyppdb.c | 6 +- ext/sat_xfopen.h | 7 - ext/{sat_xfopen.c => solv_xfopen.c} | 6 +- ext/solv_xfopen.h | 7 + package/libsolv.spec.in | 2 +- src/CMakeLists.txt | 4 +- src/bitmap.c | 8 +- src/chksum.c | 48 ++--- src/chksum.h | 20 +- src/dirpool.c | 18 +- src/dirpool.h | 2 +- src/evr.c | 22 +- src/evr.h | 2 +- src/knownid.h | 2 +- src/libsolv.ver | 54 ++--- src/md5.c | 6 +- src/md5.h | 6 +- src/policy.c | 14 +- src/pool.c | 156 +++++++------- src/pool.h | 34 +-- src/poolarch.c | 10 +- src/poolid.c | 16 +- src/poolvendor.c | 6 +- src/problems.c | 28 +-- src/qsort_r.c | 4 +- src/queue.c | 10 +- src/repo.c | 46 ++-- src/repo_solv.c | 166 +++++++-------- src/repodata.c | 166 +++++++-------- src/repopage.c | 14 +- src/rules.c | 70 +++---- src/satversion.c | 13 -- src/sha1.c | 12 +- src/sha1.h | 6 +- src/sha2.c | 56 ++--- src/sha2.h | 30 +-- src/solvable.c | 6 +- src/solver.c | 282 ++++++++++++------------- src/solverdebug.c | 186 ++++++++--------- src/solvversion.c | 13 ++ src/{satversion.h.in => solvversion.h.in} | 14 +- src/strpool.c | 28 +-- src/transaction.c | 110 +++++----- src/util.c | 58 +++--- src/util.h | 44 ++-- tools/CMakeLists.txt | 2 +- tools/common_write.c | 8 +- tools/installcheck.c | 4 +- tools/patchcheck.c | 12 +- tools/repomdxml2solv.c | 2 +- tools/rpmdb2solv.c | 4 +- tools/rpmmd2solv.c | 14 +- tools/rpms2solv.c | 6 +- tools/susetags2solv.c | 12 +- 71 files changed, 1440 insertions(+), 1440 deletions(-) delete mode 100644 ext/sat_xfopen.h rename ext/{sat_xfopen.c => solv_xfopen.c} (93%) create mode 100644 ext/solv_xfopen.h delete mode 100644 src/satversion.c create mode 100644 src/solvversion.c rename src/{satversion.h.in => solvversion.h.in} (68%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ab1cc6..9634bc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ SET (VERSION "${LIBSOLV_MAJOR}.${LIBSOLV_MINOR}.${LIBSOLV_PATCH}") ADD_DEFINITIONS (-D_FILE_OFFSET_BITS=64) ADD_DEFINITIONS (-DVERSION=\\\"${VERSION}\\\") -CONFIGURE_FILE (src/satversion.h.in src/satversion.h) +CONFIGURE_FILE (src/solvversion.h.in src/solvversion.h) SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Package dependency solver library") SET (CPACK_PACKAGE_VENDOR "SUSE") diff --git a/bindings/solv.i b/bindings/solv.i index d561bbd..3fe9bcb 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -350,7 +350,7 @@ typedef VALUE AppObjectPtr; #include "repo_deltainfoxml.h" #include "repo_repomdxml.h" #include "repo_content.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" #define true 1 #define false 1 @@ -562,28 +562,28 @@ typedef struct { typedef struct chksum { } Chksum; -%rename(xfopen) sat_xfopen; -%rename(xfopen_fd) sat_xfopen_fd; -%rename(xfopen_dup) sat_xfopen_dup; -%rename(xfclose) sat_xfclose; -%rename(xfileno) sat_xfileno; +%rename(xfopen) solv_xfopen; +%rename(xfopen_fd) solv_xfopen_fd; +%rename(xfopen_dup) solv_xfopen_dup; +%rename(xfclose) solv_xfclose; +%rename(xfileno) solv_xfileno; -FILE *sat_xfopen(const char *fn, const char *mode = 0); -FILE *sat_xfopen_fd(const char *fn, int fd, const char *mode = 0); -FILE *sat_xfopen_dup(const char *fn, int fd, const char *mode = 0); -int sat_xfclose(FILE *fp); -int sat_xfileno(FILE *fp); +FILE *solv_xfopen(const char *fn, const char *mode = 0); +FILE *solv_xfopen_fd(const char *fn, int fd, const char *mode = 0); +FILE *solv_xfopen_dup(const char *fn, int fd, const char *mode = 0); +int solv_xfclose(FILE *fp); +int solv_xfileno(FILE *fp); %{ - SWIGINTERN int sat_xfclose(FILE *fp) { + SWIGINTERN int solv_xfclose(FILE *fp) { return fclose(fp); } - SWIGINTERN int sat_xfileno(FILE *fp) { + SWIGINTERN int solv_xfileno(FILE *fp) { return fileno(fp); } - SWIGINTERN FILE *sat_xfopen_dup(const char *fn, int fd, const char *mode) { + SWIGINTERN FILE *solv_xfopen_dup(const char *fn, int fd, const char *mode) { fd = dup(fd); - return fd == -1 ? 0 : sat_xfopen_fd(fn, fd, mode); + return fd == -1 ? 0 : solv_xfopen_fd(fn, fd, mode); } %} @@ -653,7 +653,7 @@ typedef struct { static const Id SOLVER_SETMASK = SOLVER_SETMASK; Job(Pool *pool, int how, Id what) { - Job *job = sat_calloc(1, sizeof(*job)); + Job *job = solv_calloc(1, sizeof(*job)); job->pool = pool; job->how = how; job->what = what; @@ -694,56 +694,56 @@ typedef struct { %extend Chksum { Chksum(Id type) { - return (Chksum *)sat_chksum_create(type); + return (Chksum *)solv_chksum_create(type); } Chksum(Id type, const char *hex) { unsigned char buf[64]; - int l = sat_chksum_len(type); + int l = solv_chksum_len(type); if (!l) return 0; - if (sat_hex2bin(&hex, buf, sizeof(buf)) != l || hex[0]) + if (solv_hex2bin(&hex, buf, sizeof(buf)) != l || hex[0]) return 0; - return (Chksum *)sat_chksum_create_from_bin(type, buf); + return (Chksum *)solv_chksum_create_from_bin(type, buf); } ~Chksum() { - sat_chksum_free($self, 0); + solv_chksum_free($self, 0); } Id const type; %{ SWIGINTERN Id Chksum_type_get(Chksum *chksum) { - return sat_chksum_get_type(chksum); + return solv_chksum_get_type(chksum); } %} void add(const char *str) { - sat_chksum_add($self, str, strlen((char *)str)); + solv_chksum_add($self, str, strlen((char *)str)); } void add_fp(FILE *fp) { char buf[4096]; int l; while ((l = fread(buf, 1, sizeof(buf), fp)) > 0) - sat_chksum_add($self, buf, l); + solv_chksum_add($self, buf, l); rewind(fp); /* convenience */ } void add_fd(int fd) { char buf[4096]; int l; while ((l = read(fd, buf, sizeof(buf))) > 0) - sat_chksum_add($self, buf, l); + solv_chksum_add($self, buf, l); lseek(fd, 0, 0); /* convenience */ } void add_stat(const char *filename) { struct stat stb; if (stat(filename, &stb)) memset(&stb, 0, sizeof(stb)); - sat_chksum_add($self, &stb.st_dev, sizeof(stb.st_dev)); - sat_chksum_add($self, &stb.st_ino, sizeof(stb.st_ino)); - sat_chksum_add($self, &stb.st_size, sizeof(stb.st_size)); - sat_chksum_add($self, &stb.st_mtime, sizeof(stb.st_mtime)); + solv_chksum_add($self, &stb.st_dev, sizeof(stb.st_dev)); + solv_chksum_add($self, &stb.st_ino, sizeof(stb.st_ino)); + solv_chksum_add($self, &stb.st_size, sizeof(stb.st_size)); + solv_chksum_add($self, &stb.st_mtime, sizeof(stb.st_mtime)); } SWIGCDATA raw() { int l; const unsigned char *b; - b = sat_chksum_get($self, &l); + b = solv_chksum_get($self, &l); return cdata_void((void *)b, l); } %newobject hex; @@ -752,9 +752,9 @@ typedef struct { const unsigned char *b; char *ret, *rp; - b = sat_chksum_get($self, &l); - ret = sat_malloc(2 * l + 1); - sat_bin2hex(b, l, ret); + b = solv_chksum_get($self, &l); + ret = solv_malloc(2 * l + 1); + solv_bin2hex(b, l, ret); return ret; } @@ -763,10 +763,10 @@ typedef struct { const unsigned char *b, *bo; if (!chk) return 0; - if (sat_chksum_get_type($self) != sat_chksum_get_type(chk)) + if (solv_chksum_get_type($self) != solv_chksum_get_type(chk)) return 0; - b = sat_chksum_get($self, &l); - bo = sat_chksum_get(chk, 0); + b = solv_chksum_get($self, &l); + bo = solv_chksum_get(chk, 0); return memcmp(b, bo, l) == 0; } bool __ne__(Chksum *chk) { @@ -780,17 +780,17 @@ typedef struct { const char *__str__() { const char *str; const char *h = 0; - if (sat_chksum_isfinished($self)) + if (solv_chksum_isfinished($self)) h = Chksum_hex($self); - str = sat_dupjoin(sat_chksum_type2str(sat_chksum_get_type($self)), ":", h ? h : "unfinished"); - sat_free((void *)h); + str = solv_dupjoin(solv_chksum_type2str(solv_chksum_get_type($self)), ":", h ? h : "unfinished"); + solv_free((void *)h); return str; } %newobject __repr__; const char *__repr__() { const char *h = Chksum___str__($self); - const char *str = sat_dupjoin(""); - sat_free((void *)h); + const char *str = solv_dupjoin(""); + solv_free((void *)h); return str; } } @@ -927,7 +927,7 @@ typedef struct { Chksum *lookup_checksum(Id entry, Id keyname) { Id type = 0; const unsigned char *b = pool_lookup_bin_checksum($self, entry, keyname, &type); - return sat_chksum_create_from_bin(type, b); + return solv_chksum_create_from_bin(type, b); } %newobject Dataiterator; @@ -1238,7 +1238,7 @@ typedef struct { if ($self->name) { sprintf(buf, "repoid); - return sat_dupjoin(buf, $self->name, ">"); + return solv_dupjoin(buf, $self->name, ">"); } sprintf(buf, "", $self->repoid); return strdup(buf); @@ -1255,19 +1255,19 @@ typedef struct { static const int SEARCH_COMPLETE_FILELIST = SEARCH_COMPLETE_FILELIST; Dataiterator(Pool *pool, Repo *repo, Id p, Id key, const char *match, int flags) { - Dataiterator *di = sat_calloc(1, sizeof(*di)); + Dataiterator *di = solv_calloc(1, sizeof(*di)); dataiterator_init(di, pool, repo, p, key, match, flags); return di; } ~Dataiterator() { dataiterator_free($self); - sat_free($self); + solv_free($self); } #if defined(SWIGPYTHON) %newobject __iter__; Dataiterator *__iter__() { Dataiterator *ndi; - ndi = sat_calloc(1, sizeof(*ndi)); + ndi = solv_calloc(1, sizeof(*ndi)); dataiterator_init_clone(ndi, $self); return ndi; } @@ -1291,7 +1291,7 @@ typedef struct { if (!dataiterator_step($self)) { return 0; } - ndi = sat_calloc(1, sizeof(*ndi)); + ndi = solv_calloc(1, sizeof(*ndi)); dataiterator_init_clone(ndi, $self); return ndi; } @@ -1314,7 +1314,7 @@ typedef struct { %extend Datamatch { ~Datamatch() { dataiterator_free($self); - sat_free($self); + solv_free($self); } %newobject solvable; XSolvable * const solvable; @@ -1361,7 +1361,7 @@ typedef struct { %extend Pool_solvable_iterator { Pool_solvable_iterator(Pool *pool) { Pool_solvable_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->pool = pool; return s; } @@ -1369,7 +1369,7 @@ typedef struct { %newobject __iter__; Pool_solvable_iterator *__iter__() { Pool_solvable_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); *s = *$self; return s; } @@ -1420,7 +1420,7 @@ typedef struct { %extend Pool_repo_iterator { Pool_repo_iterator(Pool *pool) { Pool_repo_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->pool = pool; return s; } @@ -1428,7 +1428,7 @@ typedef struct { %newobject __iter__; Pool_repo_iterator *__iter__() { Pool_repo_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); *s = *$self; return s; } @@ -1475,7 +1475,7 @@ typedef struct { %extend Repo_solvable_iterator { Repo_solvable_iterator(Repo *repo) { Repo_solvable_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->repo = repo; return s; } @@ -1483,7 +1483,7 @@ typedef struct { %newobject __iter__; Repo_solvable_iterator *__iter__() { Repo_solvable_iterator *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); *s = *$self; return s; } @@ -1536,7 +1536,7 @@ typedef struct { Dep *s; if (!id) return 0; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->pool = pool; s->id = id; return s; @@ -1557,7 +1557,7 @@ typedef struct { const char *__repr__() { char buf[20]; sprintf(buf, "id); - return sat_dupjoin(buf, pool_dep2str($self->pool, $self->id), ">"); + return solv_dupjoin(buf, pool_dep2str($self->pool, $self->id), ">"); } } @@ -1566,7 +1566,7 @@ typedef struct { XSolvable *s; if (!id || id >= pool->nsolvables) return 0; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->pool = pool; s->id = id; return s; @@ -1590,7 +1590,7 @@ typedef struct { Chksum *lookup_checksum(Id keyname) { Id type = 0; const unsigned char *b = pool_lookup_bin_checksum($self->pool, $self->id, keyname, &type); - return sat_chksum_create_from_bin(type, b); + return solv_chksum_create_from_bin(type, b); } const char *lookup_location(int *OUTPUT) { return solvable_get_location($self->pool->solvables + $self->id, OUTPUT); @@ -1681,14 +1681,14 @@ typedef struct { const char *__repr__() { char buf[20]; sprintf(buf, "id); - return sat_dupjoin(buf, pool_solvid2str($self->pool, $self->id), ">"); + return solv_dupjoin(buf, pool_solvid2str($self->pool, $self->id), ">"); } } %extend Problem { Problem(Solver *solv, Id id) { Problem *p; - p = sat_calloc(1, sizeof(*p)); + p = solv_calloc(1, sizeof(*p)); p->solv = solv; p->id = id; return p; @@ -1740,7 +1740,7 @@ typedef struct { %extend Solution { Solution(Problem *p, Id id) { Solution *s; - s = sat_calloc(1, sizeof(*s)); + s = solv_calloc(1, sizeof(*s)); s->solv = p->solv; s->problemid = p->id; s->id = id; @@ -1796,7 +1796,7 @@ typedef struct { %extend Solutionelement { Solutionelement(Solver *solv, Id problemid, Id solutionid, Id id, Id type, Id p, Id rp) { Solutionelement *e; - e = sat_calloc(1, sizeof(*e)); + e = solv_calloc(1, sizeof(*e)); e->solv = solv; e->problemid = problemid; e->solutionid = id; @@ -2072,7 +2072,7 @@ rb_eval_string( %extend TransactionClass { TransactionClass(Transaction *trans, int mode, Id type, int count, Id fromid, Id toid) { - TransactionClass *cl = sat_calloc(1, sizeof(*cl)); + TransactionClass *cl = solv_calloc(1, sizeof(*cl)); cl->transaction = trans; cl->mode = mode; cl->type = type; @@ -2095,7 +2095,7 @@ rb_eval_string( XRule(Solver *solv, Id id) { if (!id) return 0; - XRule *xr = sat_calloc(1, sizeof(*xr)); + XRule *xr = solv_calloc(1, sizeof(*xr)); xr->solv = solv; xr->id = id; return xr; @@ -2130,7 +2130,7 @@ rb_eval_string( %extend Ruleinfo { Ruleinfo(XRule *r, Id type, Id source, Id target, Id dep) { - Ruleinfo *ri = sat_calloc(1, sizeof(*ri)); + Ruleinfo *ri = solv_calloc(1, sizeof(*ri)); ri->solv = r->solv; ri->rid = r->id; ri->type = type; @@ -2156,7 +2156,7 @@ rb_eval_string( %extend XRepodata { XRepodata(Repo *repo, Id id) { - XRepodata *xr = sat_calloc(1, sizeof(*xr)); + XRepodata *xr = solv_calloc(1, sizeof(*xr)); xr->repo = repo; xr->id = id; return xr; @@ -2180,9 +2180,9 @@ rb_eval_string( repodata_add_flexarray($self->repo->repodata + $self->id, solvid, keyname, handle); } void set_checksum(Id solvid, Id keyname, Chksum *chksum) { - const unsigned char *buf = sat_chksum_get(chksum, 0); + const unsigned char *buf = solv_chksum_get(chksum, 0); if (buf) - repodata_set_bin_checksum($self->repo->repodata + $self->id, solvid, keyname, sat_chksum_get_type(chksum), buf); + repodata_set_bin_checksum($self->repo->repodata + $self->id, solvid, keyname, solv_chksum_get_type(chksum), buf); } const char *lookup_str(Id solvid, Id keyname) { return repodata_lookup_str($self->repo->repodata + $self->id, solvid, keyname); @@ -2197,7 +2197,7 @@ rb_eval_string( Chksum *lookup_checksum(Id solvid, Id keyname) { Id type = 0; const unsigned char *b = repodata_lookup_bin_checksum($self->repo->repodata + $self->id, solvid, keyname, &type); - return sat_chksum_create_from_bin(type, b); + return solv_chksum_create_from_bin(type, b); } void internalize() { repodata_internalize($self->repo->repodata + $self->id); diff --git a/examples/solv.c b/examples/solv.c index c314511..a683387 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -72,7 +72,7 @@ #include "repo_deltainfoxml.h" #include "repo_content.h" #include "pool_fileconflicts.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" #ifdef FEDORA # define REPOINFO_PATH "/etc/yum.repos.d" @@ -120,9 +120,9 @@ yum_substitute(Pool *pool, char *line) if (!line) { - sat_free(releaseevr); + solv_free(releaseevr); releaseevr = 0; - sat_free(basearch); + solv_free(basearch); basearch = 0; return 0; } @@ -256,7 +256,7 @@ read_repoinfos(Pool *pool, const char *reposdir, int *nrepoinfosp) if (!vp) continue; *vp = 0; - repoinfos = sat_extend(repoinfos, nrepoinfos, 1, sizeof(*repoinfos), 15); + repoinfos = solv_extend(repoinfos, nrepoinfos, 1, sizeof(*repoinfos), 15); cinfo = repoinfos + nrepoinfos++; memset(cinfo, 0, sizeof(*cinfo)); cinfo->alias = strdup(kp + 1); @@ -411,11 +411,11 @@ read_repoinfos(Pool *pool, const char *reposdir, int *nrepoinfosp) kp++; if (!*kp) continue; - repoinfos = sat_extend(repoinfos, nrepoinfos, 1, sizeof(*repoinfos), 15); + repoinfos = solv_extend(repoinfos, nrepoinfos, 1, sizeof(*repoinfos), 15); cinfo = repoinfos + nrepoinfos++; memset(cinfo, 0, sizeof(*cinfo)); cinfo->baseurl = strdup(url); - cinfo->alias = sat_dupjoin(url, "/", distro); + cinfo->alias = solv_dupjoin(url, "/", distro); cinfo->name = strdup(distro); cinfo->type = TYPE_DEBIAN; cinfo->enabled = 1; @@ -434,7 +434,7 @@ read_repoinfos(Pool *pool, const char *reposdir, int *nrepoinfosp) kp++; if (*kp) *kp++ = 0; - cinfo->components = sat_extend(cinfo->components, cinfo->ncomponents, 1, sizeof(*cinfo->components), 15); + cinfo->components = solv_extend(cinfo->components, cinfo->ncomponents, 1, sizeof(*cinfo->components), 15); cinfo->components[cinfo->ncomponents++] = strdup(compo); } } @@ -455,17 +455,17 @@ free_repoinfos(struct repoinfo *repoinfos, int nrepoinfos) for (i = 0; i < nrepoinfos; i++) { struct repoinfo *cinfo = repoinfos + i; - sat_free(cinfo->name); - sat_free(cinfo->alias); - sat_free(cinfo->path); - sat_free(cinfo->metalink); - sat_free(cinfo->mirrorlist); - sat_free(cinfo->baseurl); + solv_free(cinfo->name); + solv_free(cinfo->alias); + solv_free(cinfo->path); + solv_free(cinfo->metalink); + solv_free(cinfo->mirrorlist); + solv_free(cinfo->baseurl); for (j = 0; j < cinfo->ncomponents; j++) - sat_free(cinfo->components[j]); - sat_free(cinfo->components); + solv_free(cinfo->components[j]); + solv_free(cinfo->components); } - sat_free(repoinfos); + solv_free(repoinfos); } static inline int @@ -493,24 +493,24 @@ verify_checksum(int fd, const char *file, const unsigned char *chksum, Id chksum void *h; int l; - h = sat_chksum_create(chksumtype); + h = solv_chksum_create(chksumtype); if (!h) { printf("%s: unknown checksum type\n", file); return 0; } while ((l = read(fd, buf, sizeof(buf))) > 0) - sat_chksum_add(h, buf, l); + solv_chksum_add(h, buf, l); lseek(fd, 0, SEEK_SET); l = 0; - sum = sat_chksum_get(h, &l); + sum = solv_chksum_get(h, &l); if (memcmp(sum, chksum, l)) { printf("%s: checksum mismatch\n", file); - sat_chksum_free(h, 0); + solv_chksum_free(h, 0); return 0; } - sat_chksum_free(h, 0); + solv_chksum_free(h, 0); return 1; } @@ -524,8 +524,8 @@ findfastest(char **urls, int nurls) char portstr[16]; struct addrinfo hints, *result;; - fds = sat_calloc(nurls, sizeof(*fds)); - socks = sat_calloc(nurls, sizeof(*socks)); + fds = solv_calloc(nurls, sizeof(*fds)); + socks = solv_calloc(nurls, sizeof(*socks)); for (i = 0; i < nurls; i++) { socks[i] = -1; @@ -666,7 +666,7 @@ findmetalinkurl(FILE *fp, unsigned char *chksump, Id *chksumtypep) if (chksumtypep && !*chksumtypep && !strncmp(bp, "", 20)) { bp += 20; - if (sat_hex2bin((const char **)&bp, chksump, 32) == 32) + if (solv_hex2bin((const char **)&bp, chksump, 32) == 32) *chksumtypep = REPOKEY_TYPE_SHA256; continue; } @@ -682,7 +682,7 @@ findmetalinkurl(FILE *fp, unsigned char *chksump, Id *chksumtypep) *ep = 0; if (strncmp(bp, "http", 4)) continue; - urls = sat_extend(urls, nurls, 1, sizeof(*urls), 15); + urls = solv_extend(urls, nurls, 1, sizeof(*urls), 15); urls[nurls++] = strdup(bp); } if (nurls) @@ -692,8 +692,8 @@ findmetalinkurl(FILE *fp, unsigned char *chksump, Id *chksumtypep) bp = urls[0]; urls[0] = 0; for (i = 0; i < nurls; i++) - sat_free(urls[i]); - sat_free(urls); + solv_free(urls[i]); + solv_free(urls); ep = strchr(bp, '/'); if ((ep = strchr(ep + 2, '/')) != 0) { @@ -723,7 +723,7 @@ findmirrorlisturl(FILE *fp) l = strlen(bp); while (l > 0 && (bp[l - 1] == ' ' || bp[l - 1] == '\t' || bp[l - 1] == '\n')) bp[--l] = 0; - urls = sat_extend(urls, nurls, 1, sizeof(*urls), 15); + urls = solv_extend(urls, nurls, 1, sizeof(*urls), 15); urls[nurls++] = strdup(bp); } if (nurls) @@ -733,8 +733,8 @@ findmirrorlisturl(FILE *fp) bp = urls[0]; urls[0] = 0; for (i = 0; i < nurls; i++) - sat_free(urls[i]); - sat_free(urls); + solv_free(urls[i]); + solv_free(urls); ep = strchr(bp, '/'); if ((ep = strchr(ep + 2, '/')) != 0) { @@ -850,7 +850,7 @@ curlfopen(struct repoinfo *cinfo, const char *file, int uncompress, const unsign return 0; } if (uncompress) - return sat_xfopen_fd(".gz", fd, "r"); + return solv_xfopen_fd(".gz", fd, "r"); fcntl(fd, F_SETFD, FD_CLOEXEC); return fdopen(fd, "r"); } @@ -964,26 +964,26 @@ void calc_checksum_fp(FILE *fp, Id chktype, unsigned char *out) { char buf[4096]; - void *h = sat_chksum_create(chktype); + void *h = solv_chksum_create(chktype); int l; - sat_chksum_add(h, CHKSUM_IDENT, strlen(CHKSUM_IDENT)); + solv_chksum_add(h, CHKSUM_IDENT, strlen(CHKSUM_IDENT)); while ((l = fread(buf, 1, sizeof(buf), fp)) > 0) - sat_chksum_add(h, buf, l); + solv_chksum_add(h, buf, l); rewind(fp); - sat_chksum_free(h, out); + solv_chksum_free(h, out); } void calc_checksum_stat(struct stat *stb, Id chktype, unsigned char *out) { - void *h = sat_chksum_create(chktype); - sat_chksum_add(h, CHKSUM_IDENT, strlen(CHKSUM_IDENT)); - sat_chksum_add(h, &stb->st_dev, sizeof(stb->st_dev)); - sat_chksum_add(h, &stb->st_ino, sizeof(stb->st_ino)); - sat_chksum_add(h, &stb->st_size, sizeof(stb->st_size)); - sat_chksum_add(h, &stb->st_mtime, sizeof(stb->st_mtime)); - sat_chksum_free(h, out); + void *h = solv_chksum_create(chktype); + solv_chksum_add(h, CHKSUM_IDENT, strlen(CHKSUM_IDENT)); + solv_chksum_add(h, &stb->st_dev, sizeof(stb->st_dev)); + solv_chksum_add(h, &stb->st_ino, sizeof(stb->st_ino)); + solv_chksum_add(h, &stb->st_size, sizeof(stb->st_size)); + solv_chksum_add(h, &stb->st_mtime, sizeof(stb->st_mtime)); + solv_chksum_free(h, out); } void @@ -1085,7 +1085,7 @@ writecachedrepo(Repo *repo, Repodata *info, const char *repoext, unsigned char * cinfo = repo->appdata; mkdir(SOLVCACHE_PATH, 0755); /* use dupjoin instead of tmpjoin because tmpl must survive repo_write */ - tmpl = sat_dupjoin(SOLVCACHE_PATH, "/", ".newsolv-XXXXXX"); + tmpl = solv_dupjoin(SOLVCACHE_PATH, "/", ".newsolv-XXXXXX"); fd = mkstemp(tmpl); if (fd < 0) { @@ -1494,13 +1494,13 @@ debian_find_component(struct repoinfo *cinfo, FILE *fp, char *comp, const unsign if (basearch[0] == 'i' && basearch[1] && !strcmp(basearch + 2, "86")) basearch[1] = '3'; } - binarydir = sat_dupjoin("binary-", basearch, "/"); + binarydir = solv_dupjoin("binary-", basearch, "/"); lbinarydir = strlen(binarydir); compl = strlen(comp); rewind(fp); curchksumtype = 0; filename = 0; - chksum = sat_malloc(32); + chksum = solv_malloc(32); chksumtype = 0; while(fgets(buf, sizeof(buf), fp)) { @@ -1559,12 +1559,12 @@ debian_find_component(struct repoinfo *cinfo, FILE *fp, char *comp, const unsign int curl; if (filename && !strcmp(bp, "Packages")) continue; - curl = sat_chksum_len(curchksumtype); - if (!curl || (chksumtype && sat_chksum_len(chksumtype) > curl)) + curl = solv_chksum_len(curchksumtype); + if (!curl || (chksumtype && solv_chksum_len(chksumtype) > curl)) continue; - if (sat_hex2bin(&ch, curchksum, sizeof(curchksum)) != curl) + if (solv_hex2bin(&ch, curchksum, sizeof(curchksum)) != curl) continue; - sat_free(filename); + solv_free(filename); filename = strdup(fn); chksumtype = curchksumtype; memcpy(chksum, curchksum, curl); @@ -1573,13 +1573,13 @@ debian_find_component(struct repoinfo *cinfo, FILE *fp, char *comp, const unsign free(binarydir); if (filename) { - fn = sat_dupjoin("/", filename, 0); - sat_free(filename); - filename = sat_dupjoin("dists/", cinfo->name, fn); - sat_free(fn); + fn = solv_dupjoin("/", filename, 0); + solv_free(filename); + filename = solv_dupjoin("dists/", cinfo->name, fn); + solv_free(fn); } if (!chksumtype) - chksum = sat_free(chksum); + chksum = solv_free(chksum); *chksump = chksum; *chksumtypep = chksumtype; return filename; @@ -1832,7 +1832,7 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos) case TYPE_DEBIAN: printf("debian repo '%s':", cinfo->alias); fflush(stdout); - filename = sat_dupjoin("dists/", cinfo->name, "/Release"); + filename = solv_dupjoin("dists/", cinfo->name, "/Release"); if ((fpr = curlfopen(cinfo, filename, 0, 0, 0, 0)) == 0) { printf(" no Release file, skipped\n"); @@ -1841,12 +1841,12 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos) free((char *)filename); break; } - sat_free((char *)filename); + solv_free((char *)filename); if (cinfo->repo_gpgcheck) { - filename = sat_dupjoin("dists/", cinfo->name, "/Release.gpg"); + filename = solv_dupjoin("dists/", cinfo->name, "/Release.gpg"); sigfp = curlfopen(cinfo, filename, 0, 0, 0, 0); - sat_free((char *)filename); + solv_free((char *)filename); if (!sigfp) { printf(" unsigned, skipped\n"); @@ -1884,8 +1884,8 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos) repo_add_debpackages(repo, fp, 0); fclose(fp); } - sat_free((char *)filechksum); - sat_free((char *)filename); + solv_free((char *)filechksum); + solv_free((char *)filename); } fclose(fpr); if (!badchecksum) @@ -2788,7 +2788,7 @@ main(int argc, char **argv) exit(1); } if (!commandlinepkgs) - commandlinepkgs = sat_calloc(argc, sizeof(Id)); + commandlinepkgs = solv_calloc(argc, sizeof(Id)); if (!commandlinerepo) commandlinerepo = repo_create(pool, "@commandline"); #ifndef DEBIAN @@ -2808,7 +2808,7 @@ main(int argc, char **argv) pool_addfileprovides_ids(pool, pool->installed, &addedfileprovides); if (addedfileprovides && *addedfileprovides) rewrite_repos(pool, addedfileprovides); - sat_free(addedfileprovides); + solv_free(addedfileprovides); pool_createwhatprovides(pool); queue_init(&job); @@ -2887,7 +2887,7 @@ main(int argc, char **argv) queue_free(&job); pool_free(pool); free_repoinfos(repoinfos, nrepoinfos); - sat_free(commandlinepkgs); + solv_free(commandlinepkgs); #ifdef FEDORA yum_substitute(pool, 0); #endif @@ -3014,7 +3014,7 @@ rerunsolver: queue_free(&job); pool_free(pool); free_repoinfos(repoinfos, nrepoinfos); - sat_free(commandlinepkgs); + solv_free(commandlinepkgs); #ifdef FEDORA yum_substitute(pool, 0); #endif @@ -3049,7 +3049,7 @@ rerunsolver: queue_free(&job); pool_free(pool); free_repoinfos(repoinfos, nrepoinfos); - sat_free(commandlinepkgs); + solv_free(commandlinepkgs); #ifdef FEDORA yum_substitute(pool, 0); #endif @@ -3072,7 +3072,7 @@ rerunsolver: downloadsize += solvable_lookup_num(s, SOLVABLE_DOWNLOADSIZE, 0); } printf("Downloading %d packages, %d K\n", newpkgs, downloadsize); - newpkgsfps = sat_calloc(newpkgs, sizeof(*newpkgsfps)); + newpkgsfps = solv_calloc(newpkgs, sizeof(*newpkgsfps)); for (i = 0; i < newpkgs; i++) { unsigned int medianr; @@ -3191,7 +3191,7 @@ rerunsolver: } } dataiterator_free(&di); - sat_free(matchname); + solv_free(matchname); } if (newpkgsfps[i]) @@ -3242,7 +3242,7 @@ rerunsolver: for (i = 0; i < newpkgs; i++) if (newpkgsfps[i]) fclose(newpkgsfps[i]); - newpkgsfps = sat_free(newpkgsfps); + newpkgsfps = solv_free(newpkgsfps); solver_free(solv); pool_add_fileconflicts_deps(pool, &conflicts); pool_createwhatprovides(pool); /* Hmm... */ @@ -3314,13 +3314,13 @@ rerunsolver: for (i = 0; i < newpkgs; i++) if (newpkgsfps[i]) fclose(newpkgsfps[i]); - sat_free(newpkgsfps); + solv_free(newpkgsfps); queue_free(&checkq); solver_free(solv); queue_free(&job); pool_free(pool); free_repoinfos(repoinfos, nrepoinfos); - sat_free(commandlinepkgs); + solv_free(commandlinepkgs); #ifdef FEDORA yum_substitute(pool, 0); #endif diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 687ff92..a058188 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -2,7 +2,7 @@ SET (libsolvext_SRCS repo_content.c repo_deltainfoxml.c repo_helix.c repo_products.c repo_releasefile_products.c repo_repomdxml.c repo_rpmmd.c repo_susetags.c repo_updateinfoxml.c repo_write.c repo_zyppdb.c - repo_deb.c sat_xfopen.c) + repo_deb.c solv_xfopen.c) IF (NOT DEBIAN) SET (libsolvext_SRCS ${libsolvext_SRCS} pool_fileconflicts.c repo_rpmdb.c) @@ -12,7 +12,7 @@ SET (libsolvext_HEADERS pool_fileconflicts.h repo_content.h repo_deltainfoxml.h repo_helix.h repo_products.h repo_releasefile_products.h repo_repomdxml.h repo_rpmdb.h repo_rpmmd.h repo_susetags.h repo_updateinfoxml.h repo_write.h repo_zyppdb.h - tools_util.h repo_deb.h sat_xfopen.h) + tools_util.h repo_deb.h solv_xfopen.h) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/ext/libsolvext.ver") diff --git a/ext/libsolvext.ver b/ext/libsolvext.ver index c782f0b..cc33da2 100644 --- a/ext/libsolvext.ver +++ b/ext/libsolvext.ver @@ -30,8 +30,8 @@ SOLV_1.0 { rpm_installedrpmdbids; rpm_iterate_filelist; rpm_query; - sat_xfopen; - sat_xfopen_fd; + solv_xfopen; + solv_xfopen_fd; local: *; }; diff --git a/ext/pool_fileconflicts.c b/ext/pool_fileconflicts.c index a1a1a57..5c1a4c8 100644 --- a/ext/pool_fileconflicts.c +++ b/ext/pool_fileconflicts.c @@ -43,7 +43,7 @@ doublehash(Hashval *map, Hashmask *mapnp) Hashmask nn = (mapn + 1) * 2 - 1; Hashmask *m; - m = sat_calloc(nn + 1, 2 * sizeof(Id)); + m = solv_calloc(nn + 1, 2 * sizeof(Id)); for (i = 0; i <= mapn; i++) { hx = map[2 * i]; @@ -61,7 +61,7 @@ doublehash(Hashval *map, Hashmask *mapnp) m[2 * h] = hx; m[2 * h + 1] = map[2 * i + 1]; } - sat_free(map); + solv_free(map); *mapnp = nn; return m; } @@ -204,7 +204,7 @@ findfileconflicts_cb(void *cbdatav, const char *fn, int fmode, const char *md5) static inline void addfilesspace(struct cbdata *cbdata, unsigned char *data, int len) { - cbdata->filesspace = sat_extend(cbdata->filesspace, cbdata->filesspacen, len, 1, FILESSPACE_BLOCK); + cbdata->filesspace = solv_extend(cbdata->filesspace, cbdata->filesspacen, len, 1, FILESSPACE_BLOCK); memcpy(cbdata->filesspace + cbdata->filesspacen, data, len); cbdata->filesspacen += len; } @@ -271,9 +271,9 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo if (!pkgs->count) return 0; - now = start = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "searching for file conflicts\n"); - POOL_DEBUG(SAT_DEBUG_STATS, "packages: %d, cutoff %d\n", pkgs->count, cutoff); + now = start = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "searching for file conflicts\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "packages: %d, cutoff %d\n", pkgs->count, cutoff); memset(&cbdata, 0, sizeof(cbdata)); cbdata.pool = pool; @@ -292,7 +292,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo cflmapn = (cutoff + 3) * 64; while ((cflmapn & (cflmapn - 1)) != 0) cflmapn = cflmapn & (cflmapn - 1); - cbdata.dirmap = sat_calloc(cflmapn, 2 * sizeof(Id)); + cbdata.dirmap = solv_calloc(cflmapn, 2 * sizeof(Id)); cbdata.dirmapn = cflmapn - 1; /* make it a mask */ cbdata.create = 1; idxmapset = 0; @@ -309,17 +309,17 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo idxmapset++; } - POOL_DEBUG(SAT_DEBUG_STATS, "dirmap size: %d used %d\n", cbdata.dirmapn + 1, cbdata.dirmapused); - POOL_DEBUG(SAT_DEBUG_STATS, "dirmap memory usage: %d K\n", (cbdata.dirmapn + 1) * 2 * (int)sizeof(Id) / 1024); - POOL_DEBUG(SAT_DEBUG_STATS, "dirmap creation took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "dir conflicts found: %d, idxmap %d of %d\n", cbdata.dirconflicts, idxmapset, pkgs->count); + POOL_DEBUG(SOLV_DEBUG_STATS, "dirmap size: %d used %d\n", cbdata.dirmapn + 1, cbdata.dirmapused); + POOL_DEBUG(SOLV_DEBUG_STATS, "dirmap memory usage: %d K\n", (cbdata.dirmapn + 1) * 2 * (int)sizeof(Id) / 1024); + POOL_DEBUG(SOLV_DEBUG_STATS, "dirmap creation took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "dir conflicts found: %d, idxmap %d of %d\n", cbdata.dirconflicts, idxmapset, pkgs->count); /* second pass: scan files */ - now = sat_timems(0); + now = solv_timems(0); cflmapn = (cutoff + 3) * 128; while ((cflmapn & (cflmapn - 1)) != 0) cflmapn = cflmapn & (cflmapn - 1); - cbdata.cflmap = sat_calloc(cflmapn, 2 * sizeof(Id)); + cbdata.cflmap = solv_calloc(cflmapn, 2 * sizeof(Id)); cbdata.cflmapn = cflmapn - 1; /* make it a mask */ cbdata.create = 1; for (i = 0; i < pkgs->count; i++) @@ -335,22 +335,22 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo rpm_iterate_filelist(handle, RPM_ITERATE_FILELIST_NOGHOSTS, findfileconflicts_cb, &cbdata); } - POOL_DEBUG(SAT_DEBUG_STATS, "filemap size: %d used %d\n", cbdata.cflmapn + 1, cbdata.cflmapused); - POOL_DEBUG(SAT_DEBUG_STATS, "filemap memory usage: %d K\n", (cbdata.cflmapn + 1) * 2 * (int)sizeof(Id) / 1024); - POOL_DEBUG(SAT_DEBUG_STATS, "filemap creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "filemap size: %d used %d\n", cbdata.cflmapn + 1, cbdata.cflmapused); + POOL_DEBUG(SOLV_DEBUG_STATS, "filemap memory usage: %d K\n", (cbdata.cflmapn + 1) * 2 * (int)sizeof(Id) / 1024); + POOL_DEBUG(SOLV_DEBUG_STATS, "filemap creation took %d ms\n", solv_timems(now)); - cbdata.dirmap = sat_free(cbdata.dirmap); + cbdata.dirmap = solv_free(cbdata.dirmap); cbdata.dirmapn = 0; cbdata.dirmapused = 0; - cbdata.cflmap = sat_free(cbdata.cflmap); + cbdata.cflmap = solv_free(cbdata.cflmap); cbdata.cflmapn = 0; cbdata.cflmapused = 0; map_free(&cbdata.idxmap); - now = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "lookat_dir size: %d\n", cbdata.lookat_dir.count); + now = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "lookat_dir size: %d\n", cbdata.lookat_dir.count); queue_free(&cbdata.lookat_dir); - sat_sort(cbdata.lookat.elements, cbdata.lookat.count / 2, sizeof(Id) * 2, &cand_sort, pool); + solv_sort(cbdata.lookat.elements, cbdata.lookat.count / 2, sizeof(Id) * 2, &cand_sort, pool); /* unify */ for (i = j = 0; i < cbdata.lookat.count; i += 2) { @@ -361,7 +361,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo cbdata.lookat.elements[j++] = hx; cbdata.lookat.elements[j++] = idx; } - POOL_DEBUG(SAT_DEBUG_STATS, "candidates: %d\n", cbdata.lookat.count / 2); + POOL_DEBUG(SOLV_DEBUG_STATS, "candidates: %d\n", cbdata.lookat.count / 2); /* third pass: scan candidates */ for (i = 0; i < cbdata.lookat.count - 2; i += 2) @@ -378,7 +378,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo if (cbdata.lookat.elements[i + 2] != hx) continue; /* no package left */ queue_empty(&cbdata.files); - cbdata.filesspace = sat_free(cbdata.filesspace); + cbdata.filesspace = solv_free(cbdata.filesspace); cbdata.filesspacen = 0; cbdata.idx = p; @@ -419,16 +419,16 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo } } } - cbdata.filesspace = sat_free(cbdata.filesspace); + cbdata.filesspace = solv_free(cbdata.filesspace); cbdata.filesspacen = 0; queue_free(&cbdata.lookat); queue_free(&cbdata.files); - POOL_DEBUG(SAT_DEBUG_STATS, "candidate check took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "candidate check took %d ms\n", solv_timems(now)); if (conflicts->count > 5) - sat_sort(conflicts->elements, conflicts->count / 5, 5 * sizeof(Id), conflicts_cmp, pool); + solv_sort(conflicts->elements, conflicts->count / 5, 5 * sizeof(Id), conflicts_cmp, pool); (*handle_cb)(pool, 0, handle_cbdata); - POOL_DEBUG(SAT_DEBUG_STATS, "found %d file conflicts\n", conflicts->count / 5); - POOL_DEBUG(SAT_DEBUG_STATS, "file conflict detection took %d ms\n", sat_timems(start)); + POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file conflicts\n", conflicts->count / 5); + POOL_DEBUG(SOLV_DEBUG_STATS, "file conflict detection took %d ms\n", solv_timems(start)); return conflicts->count; } diff --git a/ext/repo_content.c b/ext/repo_content.c index 102f481..53ed304 100644 --- a/ext/repo_content.c +++ b/ext/repo_content.c @@ -92,7 +92,7 @@ join(struct parsedata *pd, const char *s1, const char *s2, const char *s3) if (l > pd->tmpl) { pd->tmpl = l + 256; - pd->tmp = sat_realloc(pd->tmp, pd->tmpl); + pd->tmp = solv_realloc(pd->tmp, pd->tmpl); } p = pd->tmp; if (s1) @@ -141,7 +141,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma if (!rel || !evr) { - pool_debug(pool, SAT_FATAL, "repo_content: bad relation '%s %s'\n", name, rel); + pool_debug(pool, SOLV_FATAL, "repo_content: bad relation '%s %s'\n", name, rel); continue; } for (flags = 0; flags < 6; flags++) @@ -149,7 +149,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma break; if (flags == 6) { - pool_debug(pool, SAT_FATAL, "repo_content: unknown relation '%s'\n", rel); + pool_debug(pool, SOLV_FATAL, "repo_content: unknown relation '%s'\n", rel); continue; } id = pool_rel2id(pool, id, pool_str2id(pool, evr, 1), flags + 1, 1); @@ -223,7 +223,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) Id *otherarchs = 0; memset(&pd, 0, sizeof(pd)); - line = sat_malloc(1024); + line = solv_malloc(1024); aline = 1024; pd.repo = repo; @@ -240,7 +240,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) if (linep - line + 16 > aline) { aline = linep - line; - line = sat_realloc(line, aline + 512); + line = solv_realloc(line, aline + 512); linep = line + aline; aline += 512; } @@ -272,7 +272,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) if (istag ("CONTENTSTYLE")) { if (contentstyle) - pool_debug(pool, SAT_ERROR, "repo_content: 'CONTENTSTYLE' must be first line of 'content'\n"); + pool_debug(pool, SOLV_ERROR, "repo_content: 'CONTENTSTYLE' must be first line of 'content'\n"); contentstyle = atoi(value); continue; } @@ -335,13 +335,13 @@ repo_add_content(Repo *repo, FILE *fp, int flags) continue; if (!*value) continue; - type = sat_chksum_str2type(checksumtype); + type = solv_chksum_str2type(checksumtype); if (!type) { fprintf(stderr, "Unknown checksum type: %s: %s\n", value, checksumtype); continue; } - l = sat_chksum_len(type); + l = solv_chksum_len(type); if (strlen(checksum) != 2 * l) { fprintf(stderr, "Invalid checksum length: %s: for %s\n", value, checksum); @@ -435,7 +435,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) s->arch = pool_str2id(pool, arch, 1); while ((arch = splitword(&value)) != 0) { - otherarchs = sat_extend(otherarchs, numotherarchs, 1, sizeof(Id), 7); + otherarchs = solv_extend(otherarchs, numotherarchs, 1, sizeof(Id), 7); otherarchs[numotherarchs++] = pool_str2id(pool, arch, 1); } } @@ -485,7 +485,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) #undef istag } else - pool_debug(pool, SAT_ERROR, "repo_content: malformed line: %s\n", line); + pool_debug(pool, SOLV_ERROR, "repo_content: malformed line: %s\n", line); } if (datadir) @@ -497,7 +497,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) if (s && !s->name) { - pool_debug(pool, SAT_FATAL, "repo_content: 'content' incomplete, no product solvable created!\n"); + pool_debug(pool, SOLV_FATAL, "repo_content: 'content' incomplete, no product solvable created!\n"); repo_free_solvable_block(repo, s - pool->solvables, 1, 1); s = 0; } @@ -507,8 +507,8 @@ repo_add_content(Repo *repo, FILE *fp, int flags) s->evr = makeevr(pool, join(&pd, pd.tmpvers, "-", pd.tmprel)); else s->evr = makeevr(pool, pd.tmpvers); - pd.tmpvers = sat_free((void *)pd.tmpvers); - pd.tmprel = sat_free((void *)pd.tmprel); + pd.tmpvers = solv_free((void *)pd.tmpvers); + pd.tmprel = solv_free((void *)pd.tmprel); if (!s->arch) s->arch = ARCH_NOARCH; @@ -539,9 +539,9 @@ repo_add_content(Repo *repo, FILE *fp, int flags) } if (pd.tmp) - sat_free(pd.tmp); - sat_free(line); - sat_free(otherarchs); + solv_free(pd.tmp); + solv_free(line); + solv_free(otherarchs); join_freemem(); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); diff --git a/ext/repo_deb.c b/ext/repo_deb.c index 6e89d19..39739de 100644 --- a/ext/repo_deb.c +++ b/ext/repo_deb.c @@ -29,7 +29,7 @@ decompress(unsigned char *in, int inl, int *outlp) memset(&strm, 0, sizeof(strm)); strm.next_in = in; strm.avail_in = inl; - out = sat_malloc(4096); + out = solv_malloc(4096); strm.next_out = out; strm.avail_out = 4096; outl = 0; @@ -44,7 +44,7 @@ decompress(unsigned char *in, int inl, int *outlp) if (strm.avail_out == 0) { outl += 4096; - out = sat_realloc(out, outl + 4096); + out = solv_realloc(out, outl + 4096); strm.next_out = out + outl; strm.avail_out = 4096; } @@ -278,8 +278,8 @@ control2solvable(Solvable *s, Repodata *data, char *control) s->recommends = makedeps(repo, q, s->recommends, 0); break; case 'S' << 8 | 'H': - newtype = sat_chksum_str2type(tag); - if (!newtype || sat_chksum_len(newtype) * 2 != strlen(q)) + newtype = solv_chksum_str2type(tag); + if (!newtype || solv_chksum_len(newtype) * 2 != strlen(q)) break; if (!checksumtype || (newtype == REPOKEY_TYPE_SHA1 && checksumtype != REPOKEY_TYPE_SHA256) || newtype == REPOKEY_TYPE_SHA256) { @@ -357,7 +357,7 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags) Solvable *s; data = repo_add_repodata(repo, flags); - buf = sat_malloc(4096); + buf = solv_malloc(4096); bufl = 4096; l = 0; buf[l] = 0; @@ -369,7 +369,7 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags) int l3; if (l + 1024 >= bufl) { - buf = sat_realloc(buf, bufl + 4096); + buf = solv_realloc(buf, bufl + 4096); bufl += 4096; p = buf + l; continue; @@ -406,7 +406,7 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags) if (!s->name) repo_free_solvable_block(repo, s - pool->solvables, 1, 1); } - sat_free(buf); + solv_free(buf); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); return 0; @@ -491,7 +491,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) fclose(fp); continue; } - ctgz = sat_calloc(1, clen + 4); + ctgz = solv_calloc(1, clen + 4); bp = buf + 8 + 60 + vlen + 60; l -= 8 + 60 + vlen + 60; if (l > clen) @@ -503,7 +503,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) if (fread(ctgz + l, clen - l, 1, fp) != 1) { fprintf(stderr, "%s: unexpected EOF\n", debs[i]); - sat_free(ctgz); + solv_free(ctgz); fclose(fp); continue; } @@ -512,21 +512,21 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) gotpkgid = 0; if (flags & DEBS_ADD_WITH_PKGID) { - void *handle = sat_chksum_create(REPOKEY_TYPE_MD5); - sat_chksum_add(handle, ctgz, clen); - sat_chksum_free(handle, pkgid); + void *handle = solv_chksum_create(REPOKEY_TYPE_MD5); + solv_chksum_add(handle, ctgz, clen); + solv_chksum_free(handle, pkgid); gotpkgid = 1; } if (ctgz[0] != 0x1f || ctgz[1] != 0x8b) { fprintf(stderr, "%s: control.tar.gz is not gzipped\n", debs[i]); - sat_free(ctgz); + solv_free(ctgz); continue; } if (ctgz[2] != 8 || (ctgz[3] & 0xe0) != 0) { fprintf(stderr, "%s: control.tar.gz is compressed in a strange way\n", debs[i]); - sat_free(ctgz); + solv_free(ctgz); continue; } bp = ctgz + 4; @@ -539,7 +539,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) if (bp >= ctgz + clen) { fprintf(stderr, "%s: corrupt gzip\n", debs[i]); - sat_free(ctgz); + solv_free(ctgz); continue; } } @@ -554,11 +554,11 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) if (bp >= ctgz + clen) { fprintf(stderr, "%s: corrupt control.tar.gz\n", debs[i]); - sat_free(ctgz); + solv_free(ctgz); continue; } ctar = decompress(bp, ctgz + clen - bp, &ctarlen); - sat_free(ctgz); + solv_free(ctgz); if (!ctar) { fprintf(stderr, "%s: corrupt control.tar.gz\n", debs[i]); @@ -586,7 +586,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) continue; } memmove(ctar, bp + 512, l2); - ctar = sat_realloc(ctar, l2 + 1); + ctar = solv_realloc(ctar, l2 + 1); ctar[l2] = 0; s = pool_id2solvable(pool, repo_add_solvable(repo)); control2solvable(s, data, (char *)ctar); @@ -595,7 +595,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024)); if (gotpkgid) repodata_set_bin_checksum(data, s - pool->solvables, SOLVABLE_PKGID, REPOKEY_TYPE_MD5, pkgid); - sat_free(ctar); + solv_free(ctar); } if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); diff --git a/ext/repo_deltainfoxml.c b/ext/repo_deltainfoxml.c index 2758928..12efb3e 100644 --- a/ext/repo_deltainfoxml.c +++ b/ext/repo_deltainfoxml.c @@ -184,7 +184,7 @@ makeevr_atts(Pool *pool, struct parsedata *pd, const char **atts) l += strlen(r) + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } c = pd->content; @@ -333,7 +333,7 @@ startElement(void *userData, const char *name, const char **atts) memset(&pd->delta, 0, sizeof(pd->delta)); *pd->tempstr = 0; pd->ltemp = 0; - pd->delta.bevr = sat_extend(pd->delta.bevr, pd->delta.nbevr, 1, sizeof(Id), 7); + pd->delta.bevr = solv_extend(pd->delta.bevr, pd->delta.nbevr, 1, sizeof(Id), 7); pd->delta.bevr[pd->delta.nbevr++] = makeevr_atts(pool, pd, atts); break; case STATE_FILENAME: @@ -355,7 +355,7 @@ startElement(void *userData, const char *name, const char **atts) else if (!strcasecmp(str, "md5")) pd->delta.filechecksumtype = REPOKEY_TYPE_MD5; else - pool_debug(pool, SAT_ERROR, "unknown checksum type: '%s'\n", str); + pool_debug(pool, SOLV_ERROR, "unknown checksum type: '%s'\n", str); } case STATE_SEQUENCE: break; @@ -408,7 +408,7 @@ endElement(void *userData, const char *name) handle = repodata_new_handle(pd->data); /* we commit all handles later on in one go so that the * repodata code doesn't need to realloc every time */ - pd->handles = sat_extend(pd->handles, pd->nhandles, 1, sizeof(Id), 63); + pd->handles = solv_extend(pd->handles, pd->nhandles, 1, sizeof(Id), 63); pd->handles[pd->nhandles++] = handle; repodata_set_id(pd->data, handle, DELTA_PACKAGE_NAME, pd->newpkgname); repodata_set_id(pd->data, handle, DELTA_PACKAGE_EVR, pd->newpkgevr); @@ -472,10 +472,10 @@ endElement(void *userData, const char *name) } } - pd->delta.filechecksum = sat_free(pd->delta.filechecksum); - pd->delta.bevr = sat_free(pd->delta.bevr); + pd->delta.filechecksum = solv_free(pd->delta.filechecksum); + pd->delta.bevr = solv_free(pd->delta.bevr); pd->delta.nbevr = 0; - pd->delta.seqnum = sat_free(pd->delta.seqnum); + pd->delta.seqnum = solv_free(pd->delta.seqnum); break; case STATE_FILENAME: parse_delta_location(pd, pd->content); @@ -531,7 +531,7 @@ characterData(void *userData, const XML_Char *s, int len) l = pd->lcontent + len + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } c = pd->content + pd->lcontent; @@ -566,7 +566,7 @@ repo_add_deltainfoxml(Repo *repo, FILE *fp, int flags) pd.repo = repo; pd.data = data; - pd.content = sat_malloc(256); + pd.content = solv_malloc(256); pd.acontent = 256; pd.lcontent = 0; pd.tempstr = malloc(256); @@ -582,21 +582,21 @@ repo_add_deltainfoxml(Repo *repo, FILE *fp, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pool, SAT_FATAL, "repo_updateinfoxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pool, SOLV_FATAL, "repo_updateinfoxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); exit(1); } if (l == 0) break; } XML_ParserFree(parser); - sat_free(pd.content); - sat_free(pd.tempstr); + solv_free(pd.content); + solv_free(pd.tempstr); join_freemem(); /* now commit all handles */ for (i = 0; i < pd.nhandles; i++) repodata_add_flexarray(pd.data, SOLVID_META, REPOSITORY_DELTAINFO, pd.handles[i]); - sat_free(pd.handles); + solv_free(pd.handles); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); diff --git a/ext/repo_helix.c b/ext/repo_helix.c index 9db6bef..17e718e 100644 --- a/ext/repo_helix.c +++ b/ext/repo_helix.c @@ -816,7 +816,7 @@ repo_add_helix(Repo *repo, FILE *fp, int flags) struct stateswitch *sw; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); data = repo_add_repodata(repo, flags); /* prepare parsedata */ @@ -853,7 +853,7 @@ repo_add_helix(Repo *repo, FILE *fp, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pool, SAT_FATAL, "%s at line %u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser)); + pool_debug(pool, SOLV_FATAL, "%s at line %u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser)); exit(1); } if (l == 0) @@ -865,8 +865,8 @@ repo_add_helix(Repo *repo, FILE *fp, int flags) if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); - POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_helix took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_helix took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); return 0; } diff --git a/ext/repo_products.c b/ext/repo_products.c index 62e4f9d..0f6048a 100644 --- a/ext/repo_products.c +++ b/ext/repo_products.c @@ -291,8 +291,8 @@ endElement(void *userData, const char *name) } else if (pd->tmpvers) s->evr = makeevr(pd->pool, pd->tmpvers); /* just version, no release */ - pd->tmpvers = sat_free((void *)pd->tmpvers); - pd->tmprel = sat_free((void *)pd->tmprel); + pd->tmpvers = solv_free((void *)pd->tmpvers); + pd->tmprel = solv_free((void *)pd->tmprel); if (!s->arch) s->arch = ARCH_NOARCH; if (!s->evr) @@ -324,14 +324,14 @@ endElement(void *userData, const char *name) break; case STATE_SUMMARY: repodata_set_str(pd->data, pd->handle, langtag(pd, SOLVABLE_SUMMARY, pd->tmplang), pd->content); - pd->tmplang = sat_free((void *)pd->tmplang); + pd->tmplang = solv_free((void *)pd->tmplang); break; case STATE_SHORTSUMMARY: repodata_set_str(pd->data, pd->handle, PRODUCT_SHORTLABEL, pd->content); break; case STATE_DESCRIPTION: repodata_set_str(pd->data, pd->handle, langtag(pd, SOLVABLE_DESCRIPTION, pd->tmplang), pd->content ); - pd->tmplang = sat_free((void *)pd->tmplang); + pd->tmplang = solv_free((void *)pd->tmplang); break; case STATE_URL: if (pd->tmpurltype) @@ -339,7 +339,7 @@ endElement(void *userData, const char *name) repodata_add_poolstr_array(pd->data, pd->handle, PRODUCT_URL, pd->content); repodata_add_idarray(pd->data, pd->handle, PRODUCT_URL_TYPE, pool_str2id(pd->pool, pd->tmpurltype, 1)); } - pd->tmpurltype = sat_free((void *)pd->tmpurltype); + pd->tmpurltype = solv_free((void *)pd->tmpurltype); break; case STATE_TARGET: repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_TARGET, pd->content); @@ -374,7 +374,7 @@ characterData(void *userData, const XML_Char *s, int len) l = pd->lcontent + len + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } c = pd->content + pd->lcontent; @@ -421,8 +421,8 @@ add_code11_product(struct parsedata *pd, FILE *fp) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pd->pool, SAT_ERROR, "%s: %s at line %u:%u\n", pd->filename, XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); - pool_debug(pd->pool, SAT_ERROR, "skipping this product\n"); + pool_debug(pd->pool, SOLV_ERROR, "%s: %s at line %u:%u\n", pd->filename, XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pd->pool, SOLV_ERROR, "skipping this product\n"); XML_ParserFree(parser); return; } @@ -449,7 +449,7 @@ repo_add_code11_products(Repo *repo, const char *dirpath, int flags) pd.pool = repo->pool; pd.data = data; - pd.content = sat_malloc(256); + pd.content = solv_malloc(256); pd.acontent = 256; for (i = 0, sw = stateswitches; sw->from != NUMSTATES; i++, sw++) @@ -491,8 +491,8 @@ repo_add_code11_products(Repo *repo, const char *dirpath, int flags) } closedir(dir); } - sat_free((void *)pd.tmplang); - sat_free(pd.content); + solv_free((void *)pd.tmplang); + solv_free(pd.content); join_freemem(); if (!(flags & REPO_NO_INTERNALIZE)) diff --git a/ext/repo_repomdxml.c b/ext/repo_repomdxml.c index 04e65ee..e856beb 100644 --- a/ext/repo_repomdxml.c +++ b/ext/repo_repomdxml.c @@ -348,13 +348,13 @@ endElement(void *userData, const char *name) case STATE_CHECKSUM: case STATE_OPENCHECKSUM: { - Id type = sat_chksum_str2type(pd->tmpattr); + Id type = solv_chksum_str2type(pd->tmpattr); if (!type) { fprintf(stderr, "Unknown checksum type: %d: %s\n", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), pd->tmpattr); exit(1); } - if (strlen(pd->content) != 2 * sat_chksum_len(type)) + if (strlen(pd->content) != 2 * solv_chksum_len(type)) { fprintf(stderr, "Invalid checksum length: %d: for %s\n", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), pd->tmpattr); exit(1); @@ -486,7 +486,7 @@ repo_add_repomdxml(Repo *repo, FILE *fp, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pool, SAT_FATAL, "repo_repomdxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pool, SOLV_FATAL, "repo_repomdxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); exit(1); } if (l == 0) diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 1b6a291..c9ea676 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -173,7 +173,7 @@ headint32array(RpmHead *h, int tag, int *cnt) if (o + 4 * i > h->dcnt) return 0; d = h->dp + o; - r = sat_calloc(i ? i : 1, sizeof(unsigned int)); + r = solv_calloc(i ? i : 1, sizeof(unsigned int)); if (cnt) *cnt = i; for (o = 0; o < i; o++, d += 4) @@ -211,7 +211,7 @@ headint16array(RpmHead *h, int tag, int *cnt) if (o + 4 * i > h->dcnt) return 0; d = h->dp + o; - r = sat_calloc(i ? i : 1, sizeof(unsigned int)); + r = solv_calloc(i ? i : 1, sizeof(unsigned int)); if (cnt) *cnt = i; for (o = 0; o < i; o++, d += 2) @@ -244,7 +244,7 @@ headstringarray(RpmHead *h, int tag, int *cnt) return 0; o = d[8] << 24 | d[9] << 16 | d[10] << 8 | d[11]; i = d[12] << 24 | d[13] << 16 | d[14] << 8 | d[15]; - r = sat_calloc(i ? i : 1, sizeof(char *)); + r = solv_calloc(i ? i : 1, sizeof(char *)); if (cnt) *cnt = i; d = h->dp + o; @@ -255,7 +255,7 @@ headstringarray(RpmHead *h, int tag, int *cnt) d += strlen((char *)d) + 1; if (d >= h->dp + h->dcnt) { - sat_free(r); + solv_free(r); return 0; } } @@ -299,12 +299,12 @@ static char *headtoevr(RpmHead *h) { char epochbuf[11]; /* 32bit decimal will fit in */ sprintf(epochbuf, "%u", epoch); - evr = sat_malloc(strlen(epochbuf) + 1 + strlen(version) + 1 + strlen(release) + 1); + evr = solv_malloc(strlen(epochbuf) + 1 + strlen(version) + 1 + strlen(release) + 1); sprintf(evr, "%s:%s-%s", epochbuf, version, release); } else { - evr = sat_malloc(strlen(version) + 1 + strlen(release) + 1); + evr = solv_malloc(strlen(version) + 1 + strlen(release) + 1); sprintf(evr, "%s-%s", version, release); } return evr; @@ -364,7 +364,7 @@ setutf8string(Repodata *repodata, Id handle, Id tag, const char *str) if (c) { /* not utf8, assume latin1 */ - buf = sat_malloc(2 * strlen(str) + 1); + buf = solv_malloc(2 * strlen(str) + 1); cp = (const unsigned char *)str; str = (char *)buf; bp = buf; @@ -383,7 +383,7 @@ setutf8string(Repodata *repodata, Id handle, Id tag, const char *str) } repodata_set_str(repodata, handle, tag, str); if (buf) - sat_free(buf); + solv_free(buf); } @@ -414,13 +414,13 @@ makedeps(Pool *pool, Repo *repo, RpmHead *rpmhead, int tagn, int tagv, int tagf, v = headstringarray(rpmhead, tagv, &vc); if (!v) { - sat_free(n); + solv_free(n); return 0; } f = headint32array(rpmhead, tagf, &fc); if (!f) { - sat_free(n); + solv_free(n); free(v); return 0; } @@ -460,9 +460,9 @@ makedeps(Pool *pool, Repo *repo, RpmHead *rpmhead, int tagn, int tagv, int tagf, } if (cc == 0) { - sat_free(n); - sat_free(v); - sat_free(f); + solv_free(n); + solv_free(v); + solv_free(f); return 0; } cc += haspre; @@ -509,9 +509,9 @@ makedeps(Pool *pool, Repo *repo, RpmHead *rpmhead, int tagn, int tagv, int tagf, } *ida++ = 0; repo->idarraysize += cc + 1; - sat_free(n); - sat_free(v); - sat_free(f); + solv_free(n); + solv_free(v); + solv_free(f); return olddeps; } @@ -555,23 +555,23 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, fsz = headint32array(rpmhead, TAG_FILESIZES, &fszc); if (!fsz || fc != fszc) { - sat_free(fsz); + solv_free(fsz); return; } /* stupid rpm records sizes of directories, so we have to check the mode */ fm = headint16array(rpmhead, TAG_FILEMODES, &fszc); if (!fm || fc != fszc) { - sat_free(fsz); - sat_free(fm); + solv_free(fsz); + solv_free(fm); return; } fino = headint32array(rpmhead, TAG_FILEINODES, &fszc); if (!fino || fc != fszc) { - sat_free(fsz); - sat_free(fm); - sat_free(fino); + solv_free(fsz); + solv_free(fm); + solv_free(fino); return; } inotestok = 0; @@ -599,10 +599,10 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, unsigned int mask, hash, hh; if (!fdev || fc != fszc) { - sat_free(fsz); - sat_free(fm); - sat_free(fdev); - sat_free(fino); + solv_free(fsz); + solv_free(fm); + solv_free(fdev); + solv_free(fino); return; } mask = fc; @@ -610,7 +610,7 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, mask = mask & (mask - 1); mask <<= 2; if (mask > sizeof(inotest)/sizeof(*inotest)) - fx = sat_calloc(mask, sizeof(unsigned int)); + fx = solv_calloc(mask, sizeof(unsigned int)); else { fx = inotest; @@ -636,12 +636,12 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, fx[hash] = i + 1; } if (fx != inotest) - sat_free(fx); - sat_free(fdev); + solv_free(fx); + solv_free(fdev); } - sat_free(fino); - fn = sat_calloc(dc, sizeof(unsigned int)); - fkb = sat_calloc(dc, sizeof(unsigned int)); + solv_free(fino); + fn = solv_calloc(dc, sizeof(unsigned int)); + fkb = solv_calloc(dc, sizeof(unsigned int)); for (i = 0; i < fc; i++) { if (di[i] >= dc) @@ -651,8 +651,8 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, continue; fkb[di[i]] += fsz[i] / 1024 + 1; } - sat_free(fsz); - sat_free(fm); + solv_free(fsz); + solv_free(fm); /* commit */ handle = s - pool->solvables; for (i = 0; i < dc; i++) @@ -670,8 +670,8 @@ adddudata(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, did = repodata_str2dir(data, dn[i], 1); repodata_add_dirnumnum(data, handle, SOLVABLE_DISKUSAGE, did, fkb[i], fn[i]); } - sat_free(fn); - sat_free(fkb); + solv_free(fn); + solv_free(fkb); } /* assumes last processed array is provides! */ @@ -700,14 +700,14 @@ addfileprovides(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rp dn = headstringarray(rpmhead, TAG_DIRNAMES, &dnc); if (!dn) { - sat_free(bn); + solv_free(bn); return olddeps; } di = headint32array(rpmhead, TAG_DIRINDEXES, &dic); if (!di) { - sat_free(bn); - sat_free(dn); + solv_free(bn); + solv_free(dn); return olddeps; } if (bnc != dic) @@ -759,7 +759,7 @@ addfileprovides(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rp if (j > fna) { fna = j + 256; - fn = sat_realloc(fn, fna); + fn = solv_realloc(fn, fna); } strcpy(fn, dn[di[i]]); strcat(fn, bn[i]); @@ -783,11 +783,11 @@ addfileprovides(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rp } #if 0 if (fn) - sat_free(fn); + solv_free(fn); #endif - sat_free(bn); - sat_free(dn); - sat_free(di); + solv_free(bn); + solv_free(dn); + solv_free(di); return olddeps; } @@ -980,7 +980,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, } } } - sat_free(evr); + solv_free(evr); return 1; } @@ -1392,7 +1392,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) int count = 0, done = 0; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); memset(&dbkey, 0, sizeof(dbkey)); memset(&dbdata, 0, sizeof(dbdata)); @@ -1477,7 +1477,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) if (dbdata.size > rpmheadsize) { rpmheadsize = dbdata.size + 128; - rpmhead = sat_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); + rpmhead = solv_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); } memcpy(buf, dbdata.data, 8); rpmhead->cnt = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; @@ -1507,7 +1507,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) if (done < count) done++; if (done < count && (done - 1) * 100 / count != done * 100 / count) - pool_debug(pool, SAT_ERROR, "%%%% %d\n", done * 100 / count); + pool_debug(pool, SOLV_ERROR, "%%%% %d\n", done * 100 / count); } } if (s) @@ -1523,10 +1523,10 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) /* now sort all solvables in the new solvstart..solvend block */ if (solvend - solvstart > 1) { - pkgids = sat_malloc2(solvend - solvstart, sizeof(Id)); + pkgids = solv_malloc2(solvend - solvstart, sizeof(Id)); for (i = solvstart; i < solvend; i++) pkgids[i - solvstart] = i; - sat_sort(pkgids, solvend - solvstart, sizeof(Id), pkgids_sort_cmp, repo); + solv_sort(pkgids, solvend - solvstart, sizeof(Id), pkgids_sort_cmp, repo); /* adapt order */ for (i = solvstart; i < solvend; i++) { @@ -1536,7 +1536,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) if (j != i) swap_solvables(repo, data, i, j); } - sat_free(pkgids); + solv_free(pkgids); } } else @@ -1574,9 +1574,9 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) dp = dbdata.data; while(dl >= RPM_INDEX_SIZE) { - rpmids = sat_extend(rpmids, nrpmids, 1, sizeof(*rpmids), 255); + rpmids = solv_extend(rpmids, nrpmids, 1, sizeof(*rpmids), 255); rpmids[nrpmids].dbid = db2rpmdbid(dp, byteswapped); - rpmids[nrpmids].name = sat_malloc((int)dbkey.size + 1); + rpmids[nrpmids].name = solv_malloc((int)dbkey.size + 1); memcpy(rpmids[nrpmids].name, dbkey.data, (int)dbkey.size); rpmids[nrpmids].name[(int)dbkey.size] = 0; nrpmids++; @@ -1589,14 +1589,14 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) db = 0; /* sort rpmids */ - sat_sort(rpmids, nrpmids, sizeof(*rpmids), rpmids_sort_cmp, 0); + solv_sort(rpmids, nrpmids, sizeof(*rpmids), rpmids_sort_cmp, 0); rpmheadsize = 0; rpmhead = 0; /* create hash from dbid to ref */ refmask = mkmask(ref->nsolvables); - refhash = sat_calloc(refmask + 1, sizeof(Id)); + refhash = solv_calloc(refmask + 1, sizeof(Id)); for (i = 0; i < ref->end - ref->start; i++) { if (!ref->rpmdbid[i]) @@ -1694,7 +1694,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) if (dbdata.size > rpmheadsize) { rpmheadsize = dbdata.size + 128; - rpmhead = sat_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); + rpmhead = solv_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); } memcpy(buf, dbdata.data, 8); rpmhead->cnt = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; @@ -1713,31 +1713,31 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags) if (done < count) done++; if (done < count && (done - 1) * 100 / count != done * 100 / count) - pool_debug(pool, SAT_ERROR, "%%%% %d\n", done * 100 / count); + pool_debug(pool, SOLV_ERROR, "%%%% %d\n", done * 100 / count); } } if (refhash) - sat_free(refhash); + solv_free(refhash); if (rpmids) { for (i = 0; i < nrpmids; i++) - sat_free(rpmids[i].name); - sat_free(rpmids); + solv_free(rpmids[i].name); + solv_free(rpmids); } } if (db) db->close(db, 0); dbenv->close(dbenv, 0); if (rpmhead) - sat_free(rpmhead); + solv_free(rpmhead); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); if ((flags & RPMDB_REPORT_PROGRESS) != 0) - pool_debug(pool, SAT_ERROR, "%%%% 100\n"); - POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_rpmdb took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); + pool_debug(pool, SOLV_ERROR, "%%%% 100\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_rpmdb took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); return 0; } @@ -1787,9 +1787,9 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - chksumh = sat_chksum_free(chksumh, 0); + chksumh = solv_chksum_free(chksumh, 0); if (chksumtype) - chksumh = sat_chksum_create(chksumtype); + chksumh = solv_chksum_create(chksumtype); if (fread(lead, 96 + 16, 1, fp) != 1 || getu32(lead) != 0xedabeedb) { fprintf(stderr, "%s: not a rpm\n", rpms[i]); @@ -1797,7 +1797,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - sat_chksum_add(chksumh, lead, 96 + 16); + solv_chksum_add(chksumh, lead, 96 + 16); if (lead[78] != 0 || lead[79] != 5) { fprintf(stderr, "%s: not a V5 header\n", rpms[i]); @@ -1830,7 +1830,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) if (sigdsize > rpmheadsize) { rpmheadsize = sigdsize + 128; - rpmhead = sat_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); + rpmhead = solv_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); } if (fread(rpmhead->data, sigdsize, 1, fp) != 1) { @@ -1839,7 +1839,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - sat_chksum_add(chksumh, rpmhead->data, sigdsize); + solv_chksum_add(chksumh, rpmhead->data, sigdsize); rpmhead->cnt = sigcnt; rpmhead->dcnt = sigdsize - sigcnt * 16; rpmhead->dp = rpmhead->data + rpmhead->cnt * 16; @@ -1863,7 +1863,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - sat_chksum_add(chksumh, lead, l); + solv_chksum_add(chksumh, lead, l); sigdsize -= l; } } @@ -1874,7 +1874,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - sat_chksum_add(chksumh, lead, 16); + solv_chksum_add(chksumh, lead, 16); if (getu32(lead) != 0x8eade801) { fprintf(stderr, "%s: bad header\n", rpms[i]); @@ -1894,7 +1894,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) if (l > rpmheadsize) { rpmheadsize = l + 128; - rpmhead = sat_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); + rpmhead = solv_realloc(rpmhead, sizeof(*rpmhead) + rpmheadsize); } if (fread(rpmhead->data, l, 1, fp) != 1) { @@ -1903,7 +1903,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) continue; } if (chksumh) - sat_chksum_add(chksumh, rpmhead->data, l); + solv_chksum_add(chksumh, rpmhead->data, l); rpmhead->cnt = sigcnt; rpmhead->dcnt = sigdsize; rpmhead->dp = rpmhead->data + rpmhead->cnt * 16; @@ -1922,7 +1922,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) } if (chksumh) while ((l = fread(lead, 1, sizeof(lead), fp)) > 0) - sat_chksum_add(chksumh, lead, l); + solv_chksum_add(chksumh, lead, l); fclose(fp); s = pool_id2solvable(pool, repo_add_solvable(repo)); rpm2solv(pool, repo, data, s, rpmhead, flags); @@ -1936,13 +1936,13 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) if (gotpkgid) repodata_set_bin_checksum(data, handle, SOLVABLE_PKGID, REPOKEY_TYPE_MD5, pkgid); if (chksumh) - repodata_set_bin_checksum(data, handle, SOLVABLE_CHECKSUM, chksumtype, sat_chksum_get(chksumh, 0)); + repodata_set_bin_checksum(data, handle, SOLVABLE_CHECKSUM, chksumtype, solv_chksum_get(chksumh, 0)); } } if (chksumh) - chksumh = sat_chksum_free(chksumh, 0); + chksumh = solv_chksum_free(chksumh, 0); if (rpmhead) - sat_free(rpmhead); + solv_free(rpmhead); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); return 0; @@ -2002,30 +2002,30 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * { for (i = 0; i < dcnt; i++) (*cb)(cbdata, dn[i], 0, (char *)0); - sat_free(dn); + solv_free(dn); return; } bn = headstringarray(rpmhead, TAG_BASENAMES, &cnt); if (!bn) { - sat_free(dn); + solv_free(dn); return; } di = headint32array(rpmhead, TAG_DIRINDEXES, &cnt2); if (!di || cnt != cnt2) { - sat_free(di); - sat_free(bn); - sat_free(dn); + solv_free(di); + solv_free(bn); + solv_free(dn); return; } fm = headint16array(rpmhead, TAG_FILEMODES, &cnt2); if (!fm || cnt != cnt2) { - sat_free(fm); - sat_free(di); - sat_free(bn); - sat_free(dn); + solv_free(fm); + solv_free(di); + solv_free(bn); + solv_free(dn); return; } if ((flags & RPM_ITERATE_FILELIST_WITHMD5) != 0) @@ -2033,11 +2033,11 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * md = headstringarray(rpmhead, TAG_FILEMD5S, &cnt2); if (!md || cnt != cnt2) { - sat_free(md); - sat_free(fm); - sat_free(di); - sat_free(bn); - sat_free(dn); + solv_free(md); + solv_free(fm); + solv_free(di); + solv_free(bn); + solv_free(dn); return; } } @@ -2046,12 +2046,12 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * co = headint32array(rpmhead, TAG_FILECOLORS, &cnt2); if (!co || cnt != cnt2) { - sat_free(co); - sat_free(md); - sat_free(fm); - sat_free(di); - sat_free(bn); - sat_free(dn); + solv_free(co); + solv_free(md); + solv_free(fm); + solv_free(di); + solv_free(bn); + solv_free(dn); return; } } @@ -2060,13 +2060,13 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * ff = headint32array(rpmhead, TAG_FILEFLAGS, &cnt2); if (!ff || cnt != cnt2) { - sat_free(ff); - sat_free(co); - sat_free(md); - sat_free(fm); - sat_free(di); - sat_free(bn); - sat_free(dn); + solv_free(ff); + solv_free(co); + solv_free(md); + solv_free(fm); + solv_free(di); + solv_free(bn); + solv_free(dn); return; } } @@ -2086,7 +2086,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * if (l > spacen) { spacen = l + 16; - space = sat_realloc(space, spacen); + space = solv_realloc(space, spacen); } if (lastdir != diidx) { @@ -2105,7 +2105,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * { lt = headstringarray(rpmhead, TAG_FILELINKTOS, &cnt2); if (cnt != cnt2) - lt = sat_free(lt); + lt = solv_free(lt); } if (lt) { @@ -2121,15 +2121,15 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * } (*cb)(cbdata, space, co ? (fm[i] | co[i] << 24) : fm[i], md5p); } - sat_free(space); - sat_free(lt); - sat_free(md); - sat_free(fm); - sat_free(di); - sat_free(bn); - sat_free(dn); - sat_free(co); - sat_free(ff); + solv_free(space); + solv_free(lt); + solv_free(md); + solv_free(fm); + solv_free(di); + solv_free(bn); + solv_free(dn); + solv_free(co); + solv_free(ff); } char * @@ -2161,7 +2161,7 @@ rpm_query(void *rpmhandle, Id what) arch = "noarch"; evr = headtoevr(rpmhead); l = strlen(name) + 1 + strlen(evr) + 1 + strlen(arch) + 1; - r = sat_malloc(l); + r = solv_malloc(l); sprintf(r, "%s-%s.%s", name, evr, arch); free(evr); break; @@ -2254,11 +2254,11 @@ getinstalledrpmdbids(struct rpm_by_state *state, const char *index, const char * dp = dbdata.data; while(dl >= RPM_INDEX_SIZE) { - entries = sat_extend(entries, nentries, 1, sizeof(*entries), ENTRIES_BLOCK); + entries = solv_extend(entries, nentries, 1, sizeof(*entries), ENTRIES_BLOCK); entries[nentries].rpmdbid = db2rpmdbid(dp, byteswapped); entries[nentries].nameoff = namedatal; nentries++; - namedata = sat_extend(namedata, namedatal, dbkey.size + 1, 1, NAMEDATA_BLOCK); + namedata = solv_extend(namedata, namedatal, dbkey.size + 1, 1, NAMEDATA_BLOCK); memcpy(namedata + namedatal, dbkey.data, dbkey.size); namedata[namedatal + dbkey.size] = 0; namedatal += dbkey.size + 1; @@ -2285,7 +2285,7 @@ freestate(struct rpm_by_state *state) state->db->close(state->db, 0); if (state->dbenv) state->dbenv->close(state->dbenv, 0); - sat_free(state->rpmhead); + solv_free(state->rpmhead); } int @@ -2307,8 +2307,8 @@ rpm_installedrpmdbids(const char *rootdir, const char *index, const char *match, if (rpmdbidq) for (i = 0; i < nentries; i++) queue_push(rpmdbidq, entries[i].rpmdbid); - sat_free(entries); - sat_free(namedata); + solv_free(entries); + solv_free(namedata); freestate(&state); return nentries; } @@ -2326,14 +2326,14 @@ rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep) { /* close down */ freestate(state); - sat_free(state); + solv_free(state); *statep = (void *)0; return 0; } if (!state) { - state = sat_calloc(1, sizeof(*state)); + state = solv_calloc(1, sizeof(*state)); *statep = state; } if (!state->dbopened) @@ -2388,7 +2388,7 @@ rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep) if (dbdata.size > state->rpmheadsize) { state->rpmheadsize = dbdata.size + 128; - state->rpmhead = sat_realloc(state->rpmhead, sizeof(*rpmhead) + state->rpmheadsize); + state->rpmhead = solv_realloc(state->rpmhead, sizeof(*rpmhead) + state->rpmheadsize); } rpmhead = state->rpmhead; memcpy(buf, dbdata.data, 8); @@ -2417,7 +2417,7 @@ rpm_byfp(FILE *fp, const char *name, void **statep) return rpm_byrpmdbid(0, 0, statep); if (!state) { - state = sat_calloc(1, sizeof(*state)); + state = solv_calloc(1, sizeof(*state)); *statep = state; } if (fread(lead, 96 + 16, 1, fp) != 1 || getu32(lead) != 0xedabeedb) @@ -2479,7 +2479,7 @@ rpm_byfp(FILE *fp, const char *name, void **statep) if (l > state->rpmheadsize) { state->rpmheadsize = l + 128; - state->rpmhead = sat_realloc(state->rpmhead, sizeof(*state->rpmhead) + state->rpmheadsize); + state->rpmhead = solv_realloc(state->rpmhead, sizeof(*state->rpmhead) + state->rpmheadsize); } rpmhead = state->rpmhead; if (fread(rpmhead->data, l, 1, fp) != 1) @@ -2514,13 +2514,13 @@ rpm_byrpmh(Header h, void **statep) l = sigdsize + sigcnt * 16; if (!state) { - state = sat_calloc(1, sizeof(*state)); + state = solv_calloc(1, sizeof(*state)); *statep = state; } if (l > state->rpmheadsize) { state->rpmheadsize = l + 128; - state->rpmhead = sat_realloc(state->rpmhead, sizeof(*state->rpmhead) + state->rpmheadsize); + state->rpmhead = solv_realloc(state->rpmhead, sizeof(*state->rpmhead) + state->rpmheadsize); } rpmhead = state->rpmhead; memcpy(rpmhead->data, uh + 8, l - 8); @@ -2624,14 +2624,14 @@ unarmor(char *pubkey, int *pktlp) if (!p) return 0; l = p - pubkey; - bp = buf = sat_malloc(l * 3 / 4 + 4); + bp = buf = solv_malloc(l * 3 / 4 + 4); eof = 0; while (!eof) { pubkey = r64dec1(pubkey, &v, &eof); if (!pubkey) { - sat_free(buf); + solv_free(buf); return 0; } *bp++ = v >> 16; @@ -2643,19 +2643,19 @@ unarmor(char *pubkey, int *pktlp) bp -= eof; if (*pubkey != '=' || (pubkey = r64dec1(pubkey + 1, &v, &eof)) == 0) { - sat_free(buf); + solv_free(buf); return 0; } if (v != crc24(buf, bp - buf)) { - sat_free(buf); + solv_free(buf); return 0; } while (*pubkey == ' ' || *pubkey == '\t' || *pubkey == '\n' || *pubkey == '\r') pubkey++; if (strncmp(pubkey, "-----END PGP PUBLIC KEY BLOCK-----", 34) != 0) { - sat_free(buf); + solv_free(buf); return 0; } *pktlp = bp - buf; @@ -2728,7 +2728,7 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) return; if (tag == 6) { - pubkey = sat_realloc(pubkey, l); + pubkey = solv_realloc(pubkey, l); if (l) memcpy(pubkey, p, l); #if 0 @@ -2757,12 +2757,12 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) ql = ((p[8] << 8 | p[9]) + 7) / 8; memcpy(keyid, p + 10 + ql - 8, 8); - h = sat_chksum_create(REPOKEY_TYPE_MD5); - sat_chksum_add(h, p + 10, ql); + h = solv_chksum_create(REPOKEY_TYPE_MD5); + solv_chksum_add(h, p + 10, ql); q = p + 10 + ql; ql = ((q[0] << 8 | q[1]) + 7) / 8; - sat_chksum_add(h, q + 2, ql); - sat_chksum_free(h, fp); + solv_chksum_add(h, q + 2, ql); + solv_chksum_free(h, fp); for (i = 0; i < 16; i++) sprintf(fpx + i * 2, "%02x", fp[i]); setutf8string(data, s - s->repo->pool->solvables, PUBKEY_FINGERPRINT, fpx); @@ -2780,10 +2780,10 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) hdr[0] = 0x99; hdr[1] = l >> 8; hdr[2] = l; - h = sat_chksum_create(REPOKEY_TYPE_SHA1); - sat_chksum_add(h, hdr, 3); - sat_chksum_add(h, p, l); - sat_chksum_free(h, fp); + h = solv_chksum_create(REPOKEY_TYPE_SHA1); + solv_chksum_add(h, hdr, 3); + solv_chksum_add(h, p, l); + solv_chksum_free(h, fp); for (i = 0; i < 20; i++) sprintf(fpx + i * 2, "%02x", fp[i]); setutf8string(data, s - s->repo->pool->solvables, PUBKEY_FINGERPRINT, fpx); @@ -2819,19 +2819,19 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) htype = REPOKEY_TYPE_SHA256; if (htype) { - void *h = sat_chksum_create(htype); + void *h = solv_chksum_create(htype); unsigned char b[3], *cs; b[0] = 0x99; b[1] = pubkeyl >> 8; b[2] = pubkeyl; - sat_chksum_add(h, b, 3); - sat_chksum_add(h, pubkey, pubkeyl); + solv_chksum_add(h, b, 3); + solv_chksum_add(h, pubkey, pubkeyl); if (p[2] >= 0x10 && p[2] <= 0x13) - sat_chksum_add(h, userid, useridl); - sat_chksum_add(h, p + 2, 5); - cs = sat_chksum_get(h, 0); - sat_chksum_free(h, 0); + solv_chksum_add(h, userid, useridl); + solv_chksum_add(h, p + 2, 5); + cs = solv_chksum_get(h, 0); + solv_chksum_free(h, 0); } #endif } @@ -2931,15 +2931,15 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) htype = REPOKEY_TYPE_SHA256; if (htype && pubkeyl) { - void *h = sat_chksum_create(htype); + void *h = solv_chksum_create(htype); unsigned char b[6], *cs; unsigned int hl; b[0] = 0x99; b[1] = pubkeyl >> 8; b[2] = pubkeyl; - sat_chksum_add(h, b, 3); - sat_chksum_add(h, pubkey, pubkeyl); + solv_chksum_add(h, b, 3); + solv_chksum_add(h, pubkey, pubkeyl); if (p[1] >= 0x10 && p[1] <= 0x13) { b[0] = 0xb4; @@ -2947,20 +2947,20 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) b[2] = useridl >> 16; b[3] = useridl >> 8; b[4] = useridl; - sat_chksum_add(h, b, 5); - sat_chksum_add(h, userid, useridl); + solv_chksum_add(h, b, 5); + solv_chksum_add(h, userid, useridl); } hl = 6 + (p[4] << 8 | p[5]); - sat_chksum_add(h, p, hl); + solv_chksum_add(h, p, hl); b[0] = 4; b[1] = 0xff; b[2] = hl >> 24; b[3] = hl >> 16; b[4] = hl >> 8; b[5] = hl; - sat_chksum_add(h, b, 6); - cs = sat_chksum_get(h, 0); - sat_chksum_free(h, 0); + solv_chksum_add(h, b, 6); + cs = solv_chksum_get(h, 0); + solv_chksum_free(h, 0); } #endif if (!memcmp(keyid, issuer, 8)) @@ -2978,7 +2978,7 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) } if (tag == 13) { - userid = sat_realloc(userid, l); + userid = solv_realloc(userid, l); if (l) memcpy(userid, p, l); #if 0 @@ -2988,8 +2988,8 @@ parsekeydata(Solvable *s, Repodata *data, unsigned char *p, int pl) } if (maxex) repodata_set_num(data, s - s->repo->pool->solvables, PUBKEY_EXPIRES, maxex); - sat_free(pubkey); - sat_free(userid); + solv_free(pubkey); + solv_free(userid); } /* this is private to rpm, but rpm lacks an interface to retrieve @@ -3052,7 +3052,7 @@ pubkey2solvable(Solvable *s, Repodata *data, char *pubkey) if (dig->pubkey.userid) setutf8string(data, s - s->repo->pool->solvables, SOLVABLE_SUMMARY, dig->pubkey.userid); (void)pgpFreeDig(dig); - sat_free((void *)pkts); + solv_free((void *)pkts); return 1; } @@ -3092,8 +3092,8 @@ repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags) repo->rpmdbid = repo_sidedata_create(repo, sizeof(Id)); repo->rpmdbid[s - pool->solvables - repo->start] = entries[i].rpmdbid; } - sat_free(entries); - sat_free(namedata); + solv_free(entries); + solv_free(namedata); freestate(&state); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); @@ -3125,7 +3125,7 @@ repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags) if (bufl - l < 4096) { bufl += 4096; - buf = sat_realloc(buf, bufl); + buf = solv_realloc(buf, bufl); } ll = fread(buf, 1, bufl - l, fp); if (ll <= 0) @@ -3137,7 +3137,7 @@ repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags) s = pool_id2solvable(pool, repo_add_solvable(repo)); pubkey2solvable(s, data, buf); } - sat_free(buf); + solv_free(buf); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); return 0; diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index 99bea2c..03bfb04 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -303,7 +303,7 @@ commit_diskusage (struct parsedata *pd, unsigned handle) /* Now sort in dirid order. This ensures that parents come before their children. */ if (pd->ndirs > 1) - sat_sort(pd->dirs, pd->ndirs, sizeof (pd->dirs[0]), id3_cmp, 0); + solv_sort(pd->dirs, pd->ndirs, sizeof (pd->dirs[0]), id3_cmp, 0); /* Substract leaf numbers from all parents to make the numbers non-cumulative. This must be done post-order (i.e. all leafs adjusted before parents). We ensure this by starting at the end of @@ -396,7 +396,7 @@ makeevr_atts(Pool *pool, struct parsedata *pd, const char **atts) l += strlen(r) + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } c = pd->content; @@ -497,7 +497,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, const char **atts int l = strlen(k) + 1 + strlen(n) + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } sprintf(pd->content, "%s:%s", k, n); @@ -878,7 +878,7 @@ startElement(void *userData, const char *name, const char **atts) filesz = strtol(str, 0, 0); if ((str = find_attr("count", atts)) != 0) filenum = strtol(str, 0, 0); - pd->dirs = sat_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31); + pd->dirs = solv_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31); pd->dirs[pd->ndirs][0] = dirid; pd->dirs[pd->ndirs][1] = filesz; pd->dirs[pd->ndirs][2] = filenum; @@ -965,13 +965,13 @@ endElement(void *userData, const char *name) case STATE_CHECKSUM: { Id type, index; - type = sat_chksum_str2type(pd->tmpattr); + type = solv_chksum_str2type(pd->tmpattr); if (!type) { fprintf(stderr, "Unknown checksum type: %d: %s\n", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), pd->tmpattr); exit(1); } - if (strlen(pd->content) != 2 * sat_chksum_len(type)) + if (strlen(pd->content) != 2 * solv_chksum_len(type)) { fprintf(stderr, "Invalid checksum length: %d: for %s\n", (unsigned int)XML_GetCurrentLineNumber(*pd->parser), pd->tmpattr); exit(1); @@ -982,7 +982,7 @@ endElement(void *userData, const char *name) index = stringpool_str2id(&pd->cspool, pd->content, 1 /* create it */); if (index >= pd->ncscache) { - pd->cscache = sat_zextend(pd->cscache, pd->ncscache, index + 1 - pd->ncscache, sizeof(Id), 255); + pd->cscache = solv_zextend(pd->cscache, pd->ncscache, index + 1 - pd->ncscache, sizeof(Id), 255); pd->ncscache = index + 1; } /* add the checksum to the cache */ @@ -1009,7 +1009,7 @@ endElement(void *userData, const char *name) if (l > pd->lastdirstrl) { pd->lastdirstrl = l + 128; - pd->lastdirstr = sat_realloc(pd->lastdirstr, pd->lastdirstrl); + pd->lastdirstr = solv_realloc(pd->lastdirstr, pd->lastdirstrl); } strcpy(pd->lastdirstr, pd->content); pd->lastdir = id; @@ -1114,7 +1114,7 @@ characterData(void *userData, const XML_Char *s, int len) l = pd->lcontent + len + 1; if (l > pd->acontent) { - pd->content = sat_realloc(pd->content, l + 256); + pd->content = solv_realloc(pd->content, l + 256); pd->acontent = l + 256; } c = pd->content + pd->lcontent; @@ -1147,7 +1147,7 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags) Repodata *data; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); data = repo_add_repodata(repo, flags); memset(&pd, 0, sizeof(pd)); @@ -1162,7 +1162,7 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags) pd.data = data; - pd.content = sat_malloc(256); + pd.content = solv_malloc(256); pd.acontent = 256; pd.lcontent = 0; pd.common.tmp = 0; @@ -1184,13 +1184,13 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags) const char *str; int index; - if (!sat_chksum_len(di.key->type)) + if (!solv_chksum_len(di.key->type)) continue; str = repodata_chk2str(di.data, di.key->type, (const unsigned char *)di.kv.str); index = stringpool_str2id(&pd.cspool, str, 1); if (index >= pd.ncscache) { - pd.cscache = sat_zextend(pd.cscache, pd.ncscache, index + 1 - pd.ncscache, sizeof(Id), 255); + pd.cscache = solv_zextend(pd.cscache, pd.ncscache, index + 1 - pd.ncscache, sizeof(Id), 255); pd.ncscache = index + 1; } pd.cscache[index] = di.solvid; @@ -1208,23 +1208,23 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pool, SAT_FATAL, "repo_rpmmd: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pool, SOLV_FATAL, "repo_rpmmd: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); exit(1); } if (l == 0) break; } XML_ParserFree(parser); - sat_free(pd.content); - sat_free(pd.lastdirstr); + solv_free(pd.content); + solv_free(pd.lastdirstr); join_freemem(); stringpool_free(&pd.cspool); - sat_free(pd.cscache); + solv_free(pd.cscache); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); - POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_rpmmd took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_rpmmd took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); return 0; } diff --git a/ext/repo_susetags.c b/ext/repo_susetags.c index a8646c6..1b744a6 100644 --- a/ext/repo_susetags.c +++ b/ext/repo_susetags.c @@ -84,7 +84,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma i = split(line + 6, sp, 4); /* name, , evr, ? */ if (i != 1 && i != 3) /* expect either 'name' or 'name' 'evr' */ { - pool_debug(pool, SAT_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line); exit(1); } if (kind) @@ -99,7 +99,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma break; if (flags == 6) { - pool_debug(pool, SAT_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]); + pool_debug(pool, SOLV_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]); exit(1); } id = pool_rel2id(pool, id, evrid, flags + 1, 1); @@ -123,7 +123,7 @@ add_source(struct parsedata *pd, char *line, Solvable *s, Id handle) if (split(line, sp, 5) != 4) { - pool_debug(pool, SAT_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line); exit(1); } @@ -154,7 +154,7 @@ add_dirline(struct parsedata *pd, char *line) char *sp[6]; if (split(line, sp, 6) != 5) return; - pd->dirs = sat_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31); + pd->dirs = solv_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31); long filesz = strtol(sp[1], 0, 0); filesz += strtol(sp[2], 0, 0); long filenum = strtol(sp[3], 0, 0); @@ -179,18 +179,18 @@ set_checksum(struct parsedata *pd, Repodata *data, Id handle, Id keyname, char * Id type; if (split(line, sp, 3) != 2) { - pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line); + pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line); exit(1); } - type = sat_chksum_str2type(sp[0]); + type = solv_chksum_str2type(sp[0]); if (!type) { - pool_debug(pd->repo->pool, SAT_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]); + pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]); exit(1); } - if (strlen(sp[1]) != 2 * sat_chksum_len(type)) + if (strlen(sp[1]) != 2 * solv_chksum_len(type)) { - pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]); + pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]); exit(1); } repodata_set_checksum(data, handle, keyname, type, sp[1]); @@ -286,7 +286,7 @@ commit_diskusage(struct parsedata *pd, Id handle) /* Now sort in dirid order. This ensures that parents come before their children. */ if (pd->ndirs > 1) - sat_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0); + solv_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0); /* Substract leaf numbers from all parents to make the numbers non-cumulative. This must be done post-order (i.e. all leafs adjusted before parents). We ensure this by starting at the end of @@ -462,7 +462,7 @@ static Hashtable joinhash_init(Repo *repo, Hashmask *hmp) { Hashmask hm = mkmask(repo->nsolvables); - Hashtable ht = sat_calloc(hm + 1, sizeof(*ht)); + Hashtable ht = solv_calloc(hm + 1, sizeof(*ht)); Hashval h, hh; Solvable *s; int i; @@ -606,7 +606,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int continue; if (p - repo->start >= pd.nshare) { - pd.share_with = sat_realloc2(pd.share_with, p - repo->start + 256, sizeof(*pd.share_with)); + pd.share_with = solv_realloc2(pd.share_with, p - repo->start + 256, sizeof(*pd.share_with)); memset(pd.share_with + pd.nshare, 0, (p - repo->start + 256 - pd.nshare) * sizeof(*pd.share_with)); pd.nshare = p - repo->start + 256; } @@ -658,7 +658,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int if (is_end && strncmp(linep - 1 - intag, line + 1, intag)) { - pool_debug(pool, SAT_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag); + pool_debug(pool, SOLV_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag); } if (cummulate && !is_end) { @@ -690,7 +690,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int char *tagend = strchr(line, ':'); if (!tagend) { - pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); exit(1); } intag = tagend - (line + 1); @@ -764,7 +764,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int int i = split(line + 6, sp, 3); if (i != 2 && i != 3) { - pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line); exit(1); } set_delta_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : 0, sp[1]); @@ -781,7 +781,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int indelta = 0; break; default: - pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line); continue; } } @@ -800,7 +800,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int pd.kind = 0; if (split(line + 5, sp, 5) != 4) { - pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); exit(1); } handle = repodata_new_handle(data); @@ -833,7 +833,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int if (split(line + 5, sp, 5) != 4) { - pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line); exit(1); } s = 0; @@ -890,7 +890,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int if (indesc >= 2 && !s) { #if 0 - pool_debug(pool, SAT_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line); + pool_debug(pool, SOLV_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line); #endif continue; } @@ -958,7 +958,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int indesc++; if (createdpkgs) { - sat_free(joinhash); + solv_free(joinhash); joinhash = joinhash_init(repo, &joinhashm); createdpkgs = 0; } @@ -979,7 +979,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int int i = split(line + 6, sp, 3); if (i != 2 && i != 3) { - pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line); exit(1); } repodata_set_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : pool_id2str(pool, s->arch), sp[1]); @@ -1037,7 +1037,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int Id name, evr, arch; if (split(line + 6, sp, 5) != 4) { - pool_debug(pool, SAT_FATAL, "susetags: bad =Shr line: %s\n", line + 6); + pool_debug(pool, SOLV_FATAL, "susetags: bad =Shr line: %s\n", line + 6); exit(1); } name = pool_str2id(pool, sp[0], 1); @@ -1045,7 +1045,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int arch = pool_str2id(pool, sp[3], 1); if (last_found_pack >= pd.nshare) { - pd.share_with = sat_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with)); + pd.share_with = solv_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with)); memset(pd.share_with + pd.nshare, 0, (last_found_pack + 256 - pd.nshare) * sizeof(*pd.share_with)); pd.nshare = last_found_pack + 256; } @@ -1136,7 +1136,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int break; default: - pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line); + pool_debug(pool, SOLV_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line); break; } @@ -1199,7 +1199,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int map_free(&keyidmap); } - sat_free(joinhash); + solv_free(joinhash); if (!(flags & REPO_NO_INTERNALIZE)) repodata_internalize(data); diff --git a/ext/repo_updateinfoxml.c b/ext/repo_updateinfoxml.c index 84c9e16..fc5a1bd 100644 --- a/ext/repo_updateinfoxml.c +++ b/ext/repo_updateinfoxml.c @@ -612,7 +612,7 @@ repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pool, SAT_FATAL, "repo_updateinfoxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pool, SOLV_FATAL, "repo_updateinfoxml: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); exit(1); } if (l == 0) diff --git a/ext/repo_write.c b/ext/repo_write.c index 0efb346..13b632b 100644 --- a/ext/repo_write.c +++ b/ext/repo_write.c @@ -283,7 +283,7 @@ write_idarray_sort(FILE *fp, Pool *pool, NeedId *needid, Id *ids, Id marker) { for (i = len + 1; ids[i]; i++) ; - sids = sat_malloc2(i, sizeof(Id)); + sids = solv_malloc2(i, sizeof(Id)); memcpy(sids, lids, 64 * sizeof(Id)); for (; ids[len]; len++) { @@ -303,9 +303,9 @@ write_idarray_sort(FILE *fp, Pool *pool, NeedId *needid, Id *ids, Id marker) if (sids[i] == marker) break; if (i > 1) - sat_sort(sids, i, sizeof(Id), cmp_ids, 0); + solv_sort(sids, i, sizeof(Id), cmp_ids, 0); if ((len - i) > 2) - sat_sort(sids + i + 1, len - i - 1, sizeof(Id), cmp_ids, 0); + solv_sort(sids + i + 1, len - i - 1, sizeof(Id), cmp_ids, 0); Id id, old = 0; @@ -345,7 +345,7 @@ write_idarray_sort(FILE *fp, Pool *pool, NeedId *needid, Id *ids, Id marker) id = (id & 63) | ((id & ~63) << 1); write_id(fp, id); if (sids != lids) - sat_free(sids); + solv_free(sids); } #endif @@ -398,7 +398,7 @@ static inline void data_addid(struct extdata *xd, Id x) { unsigned char *dp; - xd->buf = sat_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); dp = xd->buf + xd->len; if (x >= (1 << 14)) @@ -447,7 +447,7 @@ data_addidarray_sort(struct extdata *xd, Pool *pool, NeedId *needid, Id *ids, Id { for (i = len + 1; ids[i]; i++) ; - sids = sat_malloc2(i, sizeof(Id)); + sids = solv_malloc2(i, sizeof(Id)); memcpy(sids, lids, 64 * sizeof(Id)); for (; ids[len]; len++) { @@ -467,9 +467,9 @@ data_addidarray_sort(struct extdata *xd, Pool *pool, NeedId *needid, Id *ids, Id if (sids[i] == marker) break; if (i > 1) - sat_sort(sids, i, sizeof(Id), cmp_ids, 0); + solv_sort(sids, i, sizeof(Id), cmp_ids, 0); if ((len - i) > 2) - sat_sort(sids + i + 1, len - i - 1, sizeof(Id), cmp_ids, 0); + solv_sort(sids + i + 1, len - i - 1, sizeof(Id), cmp_ids, 0); Id id, old = 0; @@ -509,13 +509,13 @@ data_addidarray_sort(struct extdata *xd, Pool *pool, NeedId *needid, Id *ids, Id id = (id & 63) | ((id & ~63) << 1); data_addid(xd, id); if (sids != lids) - sat_free(sids); + solv_free(sids); } static inline void data_addblob(struct extdata *xd, unsigned char *blob, int len) { - xd->buf = sat_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); memcpy(xd->buf + xd->len, blob, len); xd->len += len; } @@ -541,7 +541,7 @@ putinownpool(struct cbdata *cbdata, Stringpool *ss, Id id) int oldoff = cbdata->needid[0].map; int newoff = (id + 1 + NEEDED_BLOCK) & ~NEEDED_BLOCK; int nrels = cbdata->repo->pool->nrels; - cbdata->needid = sat_realloc2(cbdata->needid, newoff + nrels, sizeof(NeedId)); + cbdata->needid = solv_realloc2(cbdata->needid, newoff + nrels, sizeof(NeedId)); if (nrels) memmove(cbdata->needid + newoff, cbdata->needid + oldoff, nrels * sizeof(NeedId)); memset(cbdata->needid + oldoff, 0, (newoff - oldoff) * sizeof(NeedId)); @@ -642,14 +642,14 @@ repo_write_collect_needed(struct cbdata *cbdata, Repo *repo, Repodata *data, Rep } cbdata->oldschema = cbdata->schema; cbdata->oldsp = cbdata->sp; - cbdata->schema = sat_calloc(cbdata->target->nkeys, sizeof(Id)); + cbdata->schema = solv_calloc(cbdata->target->nkeys, sizeof(Id)); cbdata->sp = cbdata->schema; } else if (kv->eof == 1) { cbdata->current_sub++; *cbdata->sp = 0; - cbdata->subschemata = sat_extend(cbdata->subschemata, cbdata->nsubschemata, 1, sizeof(Id), SCHEMATA_BLOCK); + cbdata->subschemata = solv_extend(cbdata->subschemata, cbdata->nsubschemata, 1, sizeof(Id), SCHEMATA_BLOCK); cbdata->subschemata[cbdata->nsubschemata++] = repodata_schema2id(cbdata->target, cbdata->schema, 1); #if 0 fprintf(stderr, "Have schema %d\n", cbdata->subschemata[cbdata->nsubschemata-1]); @@ -658,7 +658,7 @@ repo_write_collect_needed(struct cbdata *cbdata, Repo *repo, Repodata *data, Rep } else { - sat_free(cbdata->schema); + solv_free(cbdata->schema); cbdata->schema = cbdata->oldschema; cbdata->sp = cbdata->oldsp; cbdata->oldsp = cbdata->oldschema = 0; @@ -677,7 +677,7 @@ repo_write_collect_needed(struct cbdata *cbdata, Repo *repo, Repodata *data, Rep *sp = 0; while (sp[-1]) sp--; - cbdata->subschemata = sat_extend(cbdata->subschemata, cbdata->nsubschemata, 1, sizeof(Id), SCHEMATA_BLOCK); + cbdata->subschemata = solv_extend(cbdata->subschemata, cbdata->nsubschemata, 1, sizeof(Id), SCHEMATA_BLOCK); cbdata->subschemata[cbdata->nsubschemata++] = repodata_schema2id(cbdata->target, sp, 1); cbdata->sp = kv->eof == 2 ? sp - 1: sp; } @@ -1025,9 +1025,9 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void n = ID_NUM_INTERNAL; FOR_REPODATAS(repo, i, data) n += data->nkeys; - cbdata.keymap = sat_calloc(n, sizeof(Id)); - cbdata.keymapstart = sat_calloc(repo->nrepodata, sizeof(Id)); - repodataused = sat_calloc(repo->nrepodata, 1); + cbdata.keymap = solv_calloc(n, sizeof(Id)); + cbdata.keymapstart = solv_calloc(repo->nrepodata, sizeof(Id)); + repodataused = solv_calloc(repo->nrepodata, 1); clonepool = 0; poolusage = 0; @@ -1226,7 +1226,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void cbdata.owndirpool = dirpool; } else if (dirpool) - cbdata.dirused = sat_calloc(dirpool->ndirs, sizeof(Id)); + cbdata.dirused = solv_calloc(dirpool->ndirs, sizeof(Id)); /********************************************************************/ @@ -1241,7 +1241,7 @@ for (i = 1; i < target.nkeys; i++) /* copy keys if requested */ if (keyarrayp) { - *keyarrayp = sat_calloc(2 * target.nkeys + 1, sizeof(Id)); + *keyarrayp = solv_calloc(2 * target.nkeys + 1, sizeof(Id)); for (i = 1; i < target.nkeys; i++) { (*keyarrayp)[2 * i - 2] = target.keys[i].name; @@ -1285,9 +1285,9 @@ for (i = 1; i < target.nkeys; i++) needid[0].map = reloff; cbdata.needid = needid; - cbdata.schema = sat_calloc(target.nkeys, sizeof(Id)); + cbdata.schema = solv_calloc(target.nkeys, sizeof(Id)); cbdata.sp = cbdata.schema; - cbdata.solvschemata = sat_calloc(repo->nsolvables, sizeof(Id)); + cbdata.solvschemata = solv_calloc(repo->nsolvables, sizeof(Id)); /* create main schema */ cbdata.sp = cbdata.schema; @@ -1430,7 +1430,7 @@ for (i = 1; i < target.nkeys; i++) /********************************************************************/ /* remove unused keys */ - keyused = sat_calloc(target.nkeys, sizeof(Id)); + keyused = solv_calloc(target.nkeys, sizeof(Id)); for (i = 1; i < target.schemadatalen; i++) keyused[target.schemadata[i]] = 1; keyused[0] = 0; @@ -1464,7 +1464,7 @@ for (i = 1; i < target.nkeys; i++) /* update keymap to the new key ids */ for (i = 0; i < cbdata.nkeymap; i++) cbdata.keymap[i] = keyused[cbdata.keymap[i]]; - keyused = sat_free(keyused); + keyused = solv_free(keyused); /* increment needid of the used keys, they are already mapped to * the correct string pool */ @@ -1481,7 +1481,7 @@ for (i = 1; i < target.nkeys; i++) if (dirpool && cbdata.dirused && !cbdata.dirused[0]) { /* no dirs used at all */ - cbdata.dirused = sat_free(cbdata.dirused); + cbdata.dirused = solv_free(cbdata.dirused); dirpool = 0; } @@ -1534,13 +1534,13 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); needid[i].map = i; #if 0 - sat_sort(needid + 1, spool->nstrings - 1, sizeof(*needid), needid_cmp_need_s, spool); + solv_sort(needid + 1, spool->nstrings - 1, sizeof(*needid), needid_cmp_need_s, spool); #else /* make first entry '' */ needid[1].need = 1; - sat_sort(needid + 2, spool->nstrings - 2, sizeof(*needid), needid_cmp_need_s, spool); + solv_sort(needid + 2, spool->nstrings - 2, sizeof(*needid), needid_cmp_need_s, spool); #endif - sat_sort(needid + reloff, pool->nrels, sizeof(*needid), needid_cmp_need, 0); + solv_sort(needid + reloff, pool->nrels, sizeof(*needid), needid_cmp_need, 0); /* now needid is in new order, needid[newid].map -> oldid */ /* calculate string space size, also zero out needid[].need */ @@ -1589,14 +1589,14 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); /* (dirpooldata and dirused are 0 if we have our own dirpool) */ if (cbdata.dirused && !cbdata.dirused[1]) cbdata.dirused[1] = 1; /* always want / entry */ - dirmap = sat_calloc(dirpool->ndirs, sizeof(Id)); + dirmap = solv_calloc(dirpool->ndirs, sizeof(Id)); dirmap[0] = 0; ndirmap = traverse_dirs(dirpool, dirmap, 1, dirpool_child(dirpool, 0), cbdata.dirused); /* (re)create dirused, so that it maps from "old dirid" to "new dirid" */ /* change dirmap so that it maps from "new dirid" to "new compid" */ if (!cbdata.dirused) - cbdata.dirused = sat_malloc2(dirpool->ndirs, sizeof(Id)); + cbdata.dirused = solv_malloc2(dirpool->ndirs, sizeof(Id)); memset(cbdata.dirused, 0, dirpool->ndirs * sizeof(Id)); for (i = 1; i < ndirmap; i++) { @@ -1618,7 +1618,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); * we use extdata[0] for incore data and extdata[keyid] for vertical data */ - cbdata.extdata = sat_calloc(target.nkeys, sizeof(struct extdata)); + cbdata.extdata = solv_calloc(target.nkeys, sizeof(struct extdata)); xd = cbdata.extdata; cbdata.current_sub = 0; @@ -1697,7 +1697,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); assert(cbdata.current_sub == cbdata.nsubschemata); if (cbdata.subschemata) { - cbdata.subschemata = sat_free(cbdata.subschemata); + cbdata.subschemata = solv_free(cbdata.subschemata); cbdata.nsubschemata = 0; } @@ -1724,7 +1724,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); /* * calculate prefix encoding of the strings */ - unsigned char *prefixcomp = sat_malloc(nstrings); + unsigned char *prefixcomp = solv_malloc(nstrings); unsigned int compsum = 0; char *old_str = ""; @@ -1756,7 +1756,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); write_str(fp, str + prefixcomp[i]); } } - sat_free(prefixcomp); + solv_free(prefixcomp); #if 0 /* Build the prefix-encoding of the string pool. We need to know @@ -1765,7 +1765,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); that this actually is an expansion we can't easily reuse the stringspace for this. The max expansion per string is 1 byte, so it will fit into sizeid+nstrings bytes. */ - char *prefix = sat_malloc(sizeid + nstrings); + char *prefix = solv_malloc(sizeid + nstrings); char *pp = prefix; char *old_str = ""; for (i = 1; i < nstrings; i++) @@ -1796,7 +1796,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); exit(1); } } - sat_free(prefix); + solv_free(prefix); #endif /* @@ -1820,7 +1820,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); else write_id(fp, nstrings - dirmap[i]); } - sat_free(dirmap); + solv_free(dirmap); /* * write keys @@ -1854,7 +1854,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); write_id(fp, cbdata.extdata[0].len); if (cbdata.extdata[0].len) write_blob(fp, cbdata.extdata[0].buf, cbdata.extdata[0].len); - sat_free(cbdata.extdata[0].buf); + solv_free(cbdata.extdata[0].buf); /* do we have vertical data? */ for (i = 1; i < target.nkeys; i++) @@ -1894,19 +1894,19 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); } for (i = 1; i < target.nkeys; i++) - sat_free(cbdata.extdata[i].buf); - sat_free(cbdata.extdata); + solv_free(cbdata.extdata[i].buf); + solv_free(cbdata.extdata); repodata_freedata(&target); - sat_free(needid); - sat_free(cbdata.solvschemata); - sat_free(cbdata.schema); + solv_free(needid); + solv_free(cbdata.solvschemata); + solv_free(cbdata.schema); - sat_free(cbdata.keymap); - sat_free(cbdata.keymapstart); - sat_free(cbdata.dirused); - sat_free(repodataused); + solv_free(cbdata.keymap); + solv_free(cbdata.keymapstart); + solv_free(cbdata.dirused); + solv_free(repodataused); return 0; } diff --git a/ext/repo_zyppdb.c b/ext/repo_zyppdb.c index 29570ae..84c2984 100644 --- a/ext/repo_zyppdb.c +++ b/ext/repo_zyppdb.c @@ -247,7 +247,7 @@ endElement(void *userData, const char *name) break; case STATE_SUMMARY: repodata_set_str(pd->data, pd->handle, langtag(pd, SOLVABLE_SUMMARY, pd->tmplang), pd->content); - pd->tmplang = sat_free((void *)pd->tmplang); + pd->tmplang = solv_free((void *)pd->tmplang); break; case STATE_VENDOR: s->vendor = pool_str2id(pd->pool, pd->content, 1); @@ -312,7 +312,7 @@ add_zyppdb_product(struct parsedata *pd, FILE *fp) l = fread(buf, 1, sizeof(buf), fp); if (XML_Parse(parser, buf, l, l == 0) == XML_STATUS_ERROR) { - pool_debug(pd->pool, SAT_ERROR, "repo_zyppdb: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); + pool_debug(pd->pool, SOLV_ERROR, "repo_zyppdb: %s at line %u:%u\n", XML_ErrorString(XML_GetErrorCode(parser)), (unsigned int)XML_GetCurrentLineNumber(parser), (unsigned int)XML_GetCurrentColumnNumber(parser)); return; } if (l == 0) @@ -375,7 +375,7 @@ repo_add_zyppdb_products(Repo *repo, const char *dirpath, int flags) } closedir(dir); - sat_free((void *)pd.tmplang); + solv_free((void *)pd.tmplang); free(pd.content); join_freemem(); if (!(flags & REPO_NO_INTERNALIZE)) diff --git a/ext/sat_xfopen.h b/ext/sat_xfopen.h deleted file mode 100644 index 910dfab..0000000 --- a/ext/sat_xfopen.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef SAT_XFOPEN_H -#define SAT_XFOPEN_H - -extern FILE *sat_xfopen(const char *fn, const char *mode); -extern FILE *sat_xfopen_fd(const char *fn, int fd, const char *mode); - -#endif diff --git a/ext/sat_xfopen.c b/ext/solv_xfopen.c similarity index 93% rename from ext/sat_xfopen.c rename to ext/solv_xfopen.c index cf943cf..396e1d5 100644 --- a/ext/sat_xfopen.c +++ b/ext/solv_xfopen.c @@ -12,7 +12,7 @@ #include #include -#include "sat_xfopen.h" +#include "solv_xfopen.h" static ssize_t cookie_gzread(void *cookie, char *buf, size_t nbytes) { @@ -46,7 +46,7 @@ static FILE *mygzfopen(gzFile* gzf) } FILE * -sat_xfopen(const char *fn, const char *mode) +solv_xfopen(const char *fn, const char *mode) { char *suf; gzFile *gzf; @@ -65,7 +65,7 @@ sat_xfopen(const char *fn, const char *mode) } FILE * -sat_xfopen_fd(const char *fn, int fd, const char *mode) +solv_xfopen_fd(const char *fn, int fd, const char *mode) { char *suf; gzFile *gzf; diff --git a/ext/solv_xfopen.h b/ext/solv_xfopen.h new file mode 100644 index 0000000..e722bf2 --- /dev/null +++ b/ext/solv_xfopen.h @@ -0,0 +1,7 @@ +#ifndef SOLV_XFOPEN_H +#define SOLV_XFOPEN_H + +extern FILE *solv_xfopen(const char *fn, const char *mode); +extern FILE *solv_xfopen_fd(const char *fn, int fd, const char *mode); + +#endif diff --git a/package/libsolv.spec.in b/package/libsolv.spec.in index 1c5132f..610f17d 100644 --- a/package/libsolv.spec.in +++ b/package/libsolv.spec.in @@ -2,7 +2,7 @@ Name: libsolv Version: @VERSION@ Release: 1 License: BSD 3-Clause -Url: git://gitorious.org/opensuse/sat-solver.git +Url: git://gitorious.org/opensuse/libsolv.git Source: libsolv-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: Development/Libraries/C and C++ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3750e0..6fe169d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,14 +16,14 @@ SET (libsolv_SRCS solver.c solverdebug.c repo_solv.c evr.c pool.c queue.c repo.c repodata.c repopage.c util.c policy.c solvable.c transaction.c rules.c problems.c - chksum.c md5.c sha1.c sha2.c satversion.c) + chksum.c md5.c sha1.c sha2.c solvversion.c) SET (libsolv_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h solverdebug.h repo.h repodata.h repopage.h repo_solv.h util.h strpool.h dirpool.h knownid.h transaction.h rules.h problems.h - chksum.h ${CMAKE_BINARY_DIR}/src/satversion.h) + chksum.h ${CMAKE_BINARY_DIR}/src/solvversion.h) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver") diff --git a/src/bitmap.c b/src/bitmap.c index 0485945..d57971d 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -21,14 +21,14 @@ void map_init(Map *m, int n) { m->size = (n + 7) >> 3; - m->map = m->size ? sat_calloc(m->size, 1) : 0; + m->map = m->size ? solv_calloc(m->size, 1) : 0; } /* destructor */ void map_free(Map *m) { - m->map = sat_free(m->map); + m->map = solv_free(m->map); m->size = 0; } @@ -39,7 +39,7 @@ map_init_clone(Map *t, Map *s) t->size = s->size; if (s->size) { - t->map = sat_malloc(s->size); + t->map = solv_malloc(s->size); memcpy(t->map, s->map, s->size); } else @@ -53,7 +53,7 @@ map_grow(Map *m, int n) n = (n + 7) >> 3; if (m->size < n) { - m->map = sat_realloc(m->map, n); + m->map = solv_realloc(m->map, n); memset(m->map + m->size, 0, n - m->size); m->size = n; } diff --git a/src/chksum.c b/src/chksum.c index a070a86..fb252bc 100644 --- a/src/chksum.c +++ b/src/chksum.c @@ -24,21 +24,21 @@ struct ctxhandle { }; void * -sat_chksum_create(Id type) +solv_chksum_create(Id type) { struct ctxhandle *h; - h = sat_calloc(1, sizeof(*h)); + h = solv_calloc(1, sizeof(*h)); h->type = type; switch(type) { case REPOKEY_TYPE_MD5: - sat_MD5_Init(&h->c.md5); + solv_MD5_Init(&h->c.md5); return h; case REPOKEY_TYPE_SHA1: - sat_SHA1_Init(&h->c.sha1); + solv_SHA1_Init(&h->c.sha1); return h; case REPOKEY_TYPE_SHA256: - sat_SHA256_Init(&h->c.sha256); + solv_SHA256_Init(&h->c.sha256); return h; default: break; @@ -48,13 +48,13 @@ sat_chksum_create(Id type) } void * -sat_chksum_create_from_bin(Id type, const unsigned char *buf) +solv_chksum_create_from_bin(Id type, const unsigned char *buf) { struct ctxhandle *h; - int l = sat_chksum_len(type); + int l = solv_chksum_len(type); if (buf == 0 || l == 0) return 0; - h = sat_calloc(1, sizeof(*h)); + h = solv_calloc(1, sizeof(*h)); h->type = type; h->done = 1; memcpy(h->result, buf, l); @@ -62,7 +62,7 @@ sat_chksum_create_from_bin(Id type, const unsigned char *buf) } void -sat_chksum_add(void *handle, const void *data, int len) +solv_chksum_add(void *handle, const void *data, int len) { struct ctxhandle *h = handle; if (h->done) @@ -70,13 +70,13 @@ sat_chksum_add(void *handle, const void *data, int len) switch(h->type) { case REPOKEY_TYPE_MD5: - sat_MD5_Update(&h->c.md5, (void *)data, len); + solv_MD5_Update(&h->c.md5, (void *)data, len); return; case REPOKEY_TYPE_SHA1: - sat_SHA1_Update(&h->c.sha1, data, len); + solv_SHA1_Update(&h->c.sha1, data, len); return; case REPOKEY_TYPE_SHA256: - sat_SHA256_Update(&h->c.sha256, data, len); + solv_SHA256_Update(&h->c.sha256, data, len); return; default: return; @@ -84,31 +84,31 @@ sat_chksum_add(void *handle, const void *data, int len) } const unsigned char * -sat_chksum_get(void *handle, int *lenp) +solv_chksum_get(void *handle, int *lenp) { struct ctxhandle *h = handle; if (h->done) { if (lenp) - *lenp = sat_chksum_len(h->type); + *lenp = solv_chksum_len(h->type); return h->result; } switch(h->type) { case REPOKEY_TYPE_MD5: - sat_MD5_Final(h->result, &h->c.md5); + solv_MD5_Final(h->result, &h->c.md5); h->done = 1; if (lenp) *lenp = 16; return h->result; case REPOKEY_TYPE_SHA1: - sat_SHA1_Final(&h->c.sha1, h->result); + solv_SHA1_Final(&h->c.sha1, h->result); h->done = 1; if (lenp) *lenp = 20; return h->result; case REPOKEY_TYPE_SHA256: - sat_SHA256_Final(h->result, &h->c.sha256); + solv_SHA256_Final(h->result, &h->c.sha256); h->done = 1; if (lenp) *lenp = 32; @@ -121,21 +121,21 @@ sat_chksum_get(void *handle, int *lenp) } Id -sat_chksum_get_type(void *handle) +solv_chksum_get_type(void *handle) { struct ctxhandle *h = handle; return h->type; } int -sat_chksum_isfinished(void *handle) +solv_chksum_isfinished(void *handle) { struct ctxhandle *h = handle; return h->done != 0; } const char * -sat_chksum_type2str(Id type) +solv_chksum_type2str(Id type) { switch(type) { @@ -151,7 +151,7 @@ sat_chksum_type2str(Id type) } Id -sat_chksum_str2type(const char *str) +solv_chksum_str2type(const char *str) { if (!strcasecmp(str, "md5")) return REPOKEY_TYPE_MD5; @@ -163,17 +163,17 @@ sat_chksum_str2type(const char *str) } void * -sat_chksum_free(void *handle, unsigned char *cp) +solv_chksum_free(void *handle, unsigned char *cp) { if (cp) { const unsigned char *res; int l; - res = sat_chksum_get(handle, &l); + res = solv_chksum_get(handle, &l); if (l && res) memcpy(cp, res, l); } - sat_free(handle); + solv_free(handle); return 0; } diff --git a/src/chksum.h b/src/chksum.h index 948a01a..e6706df 100644 --- a/src/chksum.h +++ b/src/chksum.h @@ -1,16 +1,16 @@ #include "pool.h" -void *sat_chksum_create(Id type); -void *sat_chksum_create_from_bin(Id type, const unsigned char *buf); -void sat_chksum_add(void *handle, const void *data, int len); -Id sat_chksum_get_type(void *handle); -int sat_chksum_isfinished(void *handle); -const unsigned char *sat_chksum_get(void *handle, int *lenp); -void *sat_chksum_free(void *handle, unsigned char *cp); -const char *sat_chksum_type2str(Id type); -Id sat_chksum_str2type(const char *str); +void *solv_chksum_create(Id type); +void *solv_chksum_create_from_bin(Id type, const unsigned char *buf); +void solv_chksum_add(void *handle, const void *data, int len); +Id solv_chksum_get_type(void *handle); +int solv_chksum_isfinished(void *handle); +const unsigned char *solv_chksum_get(void *handle, int *lenp); +void *solv_chksum_free(void *handle, unsigned char *cp); +const char *solv_chksum_type2str(Id type); +Id solv_chksum_str2type(const char *str); -static inline int sat_chksum_len(Id type) +static inline int solv_chksum_len(Id type) { switch (type) { diff --git a/src/dirpool.c b/src/dirpool.c index 85197e4..4d3281c 100644 --- a/src/dirpool.c +++ b/src/dirpool.c @@ -73,8 +73,8 @@ dirpool_init(Dirpool *dp) void dirpool_free(Dirpool *dp) { - sat_free(dp->dirs); - sat_free(dp->dirtraverse); + solv_free(dp->dirs); + solv_free(dp->dirtraverse); } void @@ -83,8 +83,8 @@ dirpool_make_dirtraverse(Dirpool *dp) Id parent, i, *dirtraverse; if (!dp->ndirs) return; - dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); - dirtraverse = sat_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); + dirtraverse = solv_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK); for (parent = 0, i = 0; i < dp->ndirs; i++) { if (dp->dirs[i] > 0) @@ -106,7 +106,7 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create) if (!create) return 0; dp->ndirs = 2; - dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); dp->dirs[0] = 0; dp->dirs[1] = 1; /* "" */ } @@ -141,16 +141,16 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create) if (dp->dirs[did] != -parent) { /* make room for parent entry */ - dp->dirs = sat_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); - dp->dirtraverse = sat_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirtraverse = solv_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); /* new parent block, link in */ dp->dirs[dp->ndirs] = -parent; dp->dirtraverse[dp->ndirs] = dp->dirtraverse[parent]; dp->dirtraverse[parent] = ++dp->ndirs; } /* make room for new entry */ - dp->dirs = sat_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); - dp->dirtraverse = sat_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirtraverse = solv_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); dp->dirs[dp->ndirs] = comp; dp->dirtraverse[dp->ndirs] = 0; return dp->ndirs++; diff --git a/src/dirpool.h b/src/dirpool.h index e68f77c..29ed109 100644 --- a/src/dirpool.h +++ b/src/dirpool.h @@ -64,7 +64,7 @@ dirpool_child(Dirpool *dp, Id did) static inline void dirpool_free_dirtraverse(Dirpool *dp) { - sat_free(dp->dirtraverse); + solv_free(dp->dirtraverse); dp->dirtraverse = 0; } diff --git a/src/evr.c b/src/evr.c index e3268b2..4942d40 100644 --- a/src/evr.c +++ b/src/evr.c @@ -21,12 +21,12 @@ #if defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS) #ifdef MULTI_SEMANTICS -# define sat_vercmp sat_vercmp_deb +# define solv_vercmp solv_vercmp_deb #endif /* debian type version compare */ int -sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) +solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) { int r, c1, c2; while (1) @@ -65,7 +65,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) } #ifdef MULTI_SEMANTICS -# undef sat_vercmp +# undef solv_vercmp #endif #endif @@ -76,7 +76,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) /* note: the code assumes that *q1 and *q2 are not alphanumeric! */ int -sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) +solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) { int r = 0; const char *e1, *e2; @@ -135,7 +135,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) #endif #if defined(MULTI_SEMANTICS) -# define sat_vercmp (*(pool->disttype == DISTTYPE_DEB ? &sat_vercmp_deb : &sat_ver##cmp)) +# define solv_vercmp (*(pool->disttype == DISTTYPE_DEB ? &solv_vercmp_deb : &solv_ver##cmp)) #endif /* edition (e:v-r) compare */ @@ -172,7 +172,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) s2 = 0; if (s1 && s2) { - r = sat_vercmp(evr1, s1, evr2, s2); + r = solv_vercmp(evr1, s1, evr2, s2); if (r) return r; evr1 = s1 + 1; @@ -206,7 +206,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) r = 0; if (mode != EVRCMP_MATCH || (evr1 != (r1 ? r1 : s1) && evr2 != (r2 ? r2 : s2))) - r = sat_vercmp(evr1, r1 ? r1 : s1, evr2, r2 ? r2 : s2); + r = solv_vercmp(evr1, r1 ? r1 : s1, evr2, r2 ? r2 : s2); if (r) return r; @@ -222,7 +222,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) if (r1 && r2) { if (s1 != ++r1 && s2 != ++r2) - r = sat_vercmp(r1, s1, r2, s2); + r = solv_vercmp(r1, s1, r2, s2); } return r; } @@ -253,7 +253,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version { if (epoch) { - r = sat_vercmp(evr1, s1, epoch, epoch + strlen(epoch)); + r = solv_vercmp(evr1, s1, epoch, epoch + strlen(epoch)); if (r) return r; } @@ -271,7 +271,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version r1 = s1; if (version) { - r = sat_vercmp(evr1, r1 ? r1 : s1, version, version + strlen(version)); + r = solv_vercmp(evr1, r1 ? r1 : s1, version, version + strlen(version)); if (r) return r; } @@ -279,7 +279,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version { if (!r1) return -1; - r = sat_vercmp(r1 + 1, s1, release, release + strlen(release)); + r = solv_vercmp(r1 + 1, s1, release, release + strlen(release)); if (r) return r; } diff --git a/src/evr.h b/src/evr.h index e1f5457..787b6bb 100644 --- a/src/evr.h +++ b/src/evr.h @@ -24,7 +24,7 @@ extern "C" { #define EVRCMP_MATCH 2 #define EVRCMP_COMPARE_EVONLY 3 -extern int sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2); +extern int solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2); extern int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode); extern int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode); diff --git a/src/knownid.h b/src/knownid.h index 7757ae0..fdf7b0f 100644 --- a/src/knownid.h +++ b/src/knownid.h @@ -21,7 +21,7 @@ static const char *initpool_data[] = { #else # define KNOWNID(a, b) a -enum sat_knownid { +enum solv_knownid { #endif KNOWNID(ID_NULL, ""), diff --git a/src/libsolv.ver b/src/libsolv.ver index 5080879..5fa4af6 100644 --- a/src/libsolv.ver +++ b/src/libsolv.ver @@ -193,33 +193,33 @@ SOLV_1.0 { repodata_str2dir; repodata_stringify; repopagestore_compress_page; - sat_bin2hex; - sat_calloc; - sat_chksum_add; - sat_chksum_create; - sat_chksum_create_from_bin; - sat_chksum_free; - sat_chksum_get; - sat_chksum_get_type; - sat_chksum_isfinished; - sat_chksum_str2type; - sat_chksum_type2str; - sat_dupappend; - sat_dupjoin; - sat_free; - sat_hex2bin; - sat_malloc; - sat_malloc2; - sat_oom; - sat_realloc; - sat_realloc2; - sat_sort; - sat_timems; - sat_vercmp; - sat_version; - sat_version_major; - sat_version_minor; - sat_version_patch; + solv_bin2hex; + solv_calloc; + solv_chksum_add; + solv_chksum_create; + solv_chksum_create_from_bin; + solv_chksum_free; + solv_chksum_get; + solv_chksum_get_type; + solv_chksum_isfinished; + solv_chksum_str2type; + solv_chksum_type2str; + solv_dupappend; + solv_dupjoin; + solv_free; + solv_hex2bin; + solv_malloc; + solv_malloc2; + solv_oom; + solv_realloc; + solv_realloc2; + solv_sort; + solv_timems; + solv_vercmp; + solv_version; + solv_version_major; + solv_version_minor; + solv_version_patch; solvable_get_location; solvable_identical; solvable_lookup_bin_checksum; diff --git a/src/md5.c b/src/md5.c index 8378a47..85bbd6a 100644 --- a/src/md5.c +++ b/src/md5.c @@ -173,7 +173,7 @@ static void *body(MD5_CTX *ctx, void *data, unsigned long size) return ptr; } -void sat_MD5_Init(MD5_CTX *ctx) +void solv_MD5_Init(MD5_CTX *ctx) { ctx->a = 0x67452301; ctx->b = 0xefcdab89; @@ -184,7 +184,7 @@ void sat_MD5_Init(MD5_CTX *ctx) ctx->hi = 0; } -void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) +void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) { MD5_u32plus saved_lo; unsigned long used, free; @@ -218,7 +218,7 @@ void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) memcpy(ctx->buffer, data, size); } -void sat_MD5_Final(unsigned char *result, MD5_CTX *ctx) +void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx) { unsigned long used, free; diff --git a/src/md5.h b/src/md5.h index a304003..54533c7 100644 --- a/src/md5.h +++ b/src/md5.h @@ -16,6 +16,6 @@ typedef struct { MD5_u32plus block[16]; } MD5_CTX; -extern void sat_MD5_Init(MD5_CTX *ctx); -extern void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); -extern void sat_MD5_Final(unsigned char *result, MD5_CTX *ctx); +extern void solv_MD5_Init(MD5_CTX *ctx); +extern void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); +extern void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx); diff --git a/src/policy.c b/src/policy.c index ab5f55b..9e6a01f 100644 --- a/src/policy.c +++ b/src/policy.c @@ -114,7 +114,7 @@ prune_to_highest_prio_per_name(Pool *pool, Queue *plist) Id name; queue_init(&pq); - sat_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); + solv_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); queue_push(&pq, plist->elements[0]); name = pool->solvables[pq.elements[0]].name; for (i = 1, j = 0; i < plist->count; i++) @@ -359,10 +359,10 @@ prune_to_best_version(Pool *pool, Queue *plist) if (plist->count < 2) /* no need to prune for a single entry */ return; - POOL_DEBUG(SAT_DEBUG_POLICY, "prune_to_best_version %d\n", plist->count); + POOL_DEBUG(SOLV_DEBUG_POLICY, "prune_to_best_version %d\n", plist->count); /* sort by name first, prefer installed */ - sat_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); + solv_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); /* now find best 'per name' */ best = 0; @@ -370,7 +370,7 @@ prune_to_best_version(Pool *pool, Queue *plist) { s = pool->solvables + plist->elements[i]; - POOL_DEBUG(SAT_DEBUG_POLICY, "- %s[%s]\n", + POOL_DEBUG(SOLV_DEBUG_POLICY, "- %s[%s]\n", pool_solvable2str(pool, s), (pool->installed && s->repo == pool->installed) ? "installed" : "not installed"); @@ -580,7 +580,7 @@ policy_create_obsolete_index(Solver *solv) if (!installed || installed->start == installed->end) return; cnt = installed->end - installed->start; - solv->obsoletes = obsoletes = sat_calloc(cnt, sizeof(Id)); + solv->obsoletes = obsoletes = solv_calloc(cnt, sizeof(Id)); for (i = 1; i < pool->nsolvables; i++) { s = pool->solvables + i; @@ -613,8 +613,8 @@ policy_create_obsolete_index(Solver *solv) n += obsoletes[i] + 1; obsoletes[i] = n; } - solv->obsoletes_data = obsoletes_data = sat_calloc(n + 1, sizeof(Id)); - POOL_DEBUG(SAT_DEBUG_STATS, "obsoletes data: %d entries\n", n + 1); + solv->obsoletes_data = obsoletes_data = solv_calloc(n + 1, sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "obsoletes data: %d entries\n", n + 1); for (i = pool->nsolvables - 1; i > 0; i--) { s = pool->solvables + i; diff --git a/src/pool.c b/src/pool.c index e9035a1..b6586d0 100644 --- a/src/pool.c +++ b/src/pool.c @@ -40,17 +40,17 @@ pool_create(void) Pool *pool; Solvable *s; - pool = (Pool *)sat_calloc(1, sizeof(*pool)); + pool = (Pool *)solv_calloc(1, sizeof(*pool)); stringpool_init (&pool->ss, initpool_data); /* alloc space for RelDep 0 */ - pool->rels = sat_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); pool->nrels = 1; memset(pool->rels, 0, sizeof(Reldep)); /* alloc space for Solvable 0 and system solvable */ - pool->solvables = sat_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK); pool->nsolvables = 2; memset(pool->solvables, 0, 2 * sizeof(Solvable)); s = pool->solvables + SYSTEMSOLVABLE; @@ -60,7 +60,7 @@ pool_create(void) queue_init(&pool->vendormap); - pool->debugmask = SAT_DEBUG_RESULT; /* FIXME */ + pool->debugmask = SOLV_DEBUG_RESULT; /* FIXME */ #ifdef FEDORA pool->obsoleteusescolors = 1; #endif @@ -87,19 +87,19 @@ pool_free(Pool *pool) pool_freewhatprovides(pool); pool_freeidhashes(pool); repo_freeallrepos(pool, 1); - sat_free(pool->id2arch); - sat_free(pool->solvables); + solv_free(pool->id2arch); + solv_free(pool->solvables); stringpool_free(&pool->ss); - sat_free(pool->rels); + solv_free(pool->rels); pool_setvendorclasses(pool, 0); queue_free(&pool->vendormap); for (i = 0; i < POOL_TMPSPACEBUF; i++) - sat_free(pool->tmpspace.buf[i]); + solv_free(pool->tmpspace.buf[i]); for (i = 0; i < pool->nlanguages; i++) free((char *)pool->languages[i]); - sat_free(pool->languages); - sat_free(pool->languagecache); - sat_free(pool); + solv_free(pool->languages); + solv_free(pool->languagecache); + solv_free(pool); } #ifdef MULTI_SEMANTICS @@ -113,7 +113,7 @@ pool_setdisttype(Pool *pool, int disttype) Id pool_add_solvable(Pool *pool) { - pool->solvables = sat_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK); memset(pool->solvables + pool->nsolvables, 0, sizeof(Solvable)); return pool->nsolvables++; } @@ -124,7 +124,7 @@ pool_add_solvable_block(Pool *pool, int count) Id nsolvables = pool->nsolvables; if (!count) return nsolvables; - pool->solvables = sat_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK); memset(pool->solvables + nsolvables, 0, sizeof(Solvable) * count); pool->nsolvables += count; return nsolvables; @@ -195,10 +195,10 @@ pool_shrink_whatprovides(Pool *pool) if (pool->ss.nstrings < 3) return; - sorted = sat_malloc2(pool->ss.nstrings, sizeof(Id)); + sorted = solv_malloc2(pool->ss.nstrings, sizeof(Id)); for (id = 0; id < pool->ss.nstrings; id++) sorted[id] = id; - sat_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool); + solv_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool); last = 0; lastid = 0; for (i = 1; i < pool->ss.nstrings; i++) @@ -228,7 +228,7 @@ pool_shrink_whatprovides(Pool *pool) last = pool->whatprovidesdata + o; lastid = id; } - sat_free(sorted); + solv_free(sorted); dp = pool->whatprovidesdata + 2; for (id = 1; id < pool->ss.nstrings; id++) { @@ -251,12 +251,12 @@ pool_shrink_whatprovides(Pool *pool) ; } o = dp - pool->whatprovidesdata; - POOL_DEBUG(SAT_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o); + POOL_DEBUG(SOLV_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o); if (pool->whatprovidesdataoff == o) return; r = pool->whatprovidesdataoff - o; pool->whatprovidesdataoff = o; - pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id)); + pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id)); if (r > pool->whatprovidesdataleft) r = pool->whatprovidesdataleft; memset(pool->whatprovidesdata + o, 0, r * sizeof(Id)); @@ -282,15 +282,15 @@ pool_createwhatprovides(Pool *pool) Repo *installed = pool->installed; unsigned int now; - now = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels); + now = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels); pool_freeidhashes(pool); /* XXX: should not be here! */ pool_freewhatprovides(pool); num = pool->ss.nstrings; - pool->whatprovides = whatprovides = sat_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK); - pool->whatprovides_rel = sat_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK); + pool->whatprovides = whatprovides = solv_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK); + pool->whatprovides_rel = solv_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK); /* count providers for each name */ for (i = pool->nsolvables - 1; i > 0; i--) @@ -327,17 +327,17 @@ pool_createwhatprovides(Pool *pool) np++; /* inc # of provider 'slots' for stats */ } - POOL_DEBUG(SAT_DEBUG_STATS, "provide ids: %d\n", np); + POOL_DEBUG(SOLV_DEBUG_STATS, "provide ids: %d\n", np); /* reserve some space for relation data */ extra = 2 * pool->nrels; if (extra < 256) extra = 256; - POOL_DEBUG(SAT_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra); + POOL_DEBUG(SOLV_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra); /* alloc space for all providers + extra */ - whatprovidesdata = sat_calloc(off + extra, sizeof(Id)); + whatprovidesdata = solv_calloc(off + extra, sizeof(Id)); /* now fill data for all provides */ for (i = pool->nsolvables - 1; i > 0; i--) @@ -370,8 +370,8 @@ pool_createwhatprovides(Pool *pool) pool->whatprovidesdataoff = off; pool->whatprovidesdataleft = extra; pool_shrink_whatprovides(pool); - POOL_DEBUG(SAT_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id))); - POOL_DEBUG(SAT_DEBUG_STATS, "createwhatprovides took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "createwhatprovides took %d ms\n", solv_timems(now)); } /* @@ -382,9 +382,9 @@ pool_createwhatprovides(Pool *pool) void pool_freewhatprovides(Pool *pool) { - pool->whatprovides = sat_free(pool->whatprovides); - pool->whatprovides_rel = sat_free(pool->whatprovides_rel); - pool->whatprovidesdata = sat_free(pool->whatprovidesdata); + pool->whatprovides = solv_free(pool->whatprovides); + pool->whatprovides_rel = solv_free(pool->whatprovides_rel); + pool->whatprovidesdata = solv_free(pool->whatprovidesdata); pool->whatprovidesdataoff = 0; pool->whatprovidesdataleft = 0; } @@ -413,8 +413,8 @@ pool_queuetowhatprovides(Pool *pool, Queue *q) /* extend whatprovidesdata if needed, +1 for ID_NULL-termination */ if (pool->whatprovidesdataleft < count + 1) { - POOL_DEBUG(SAT_DEBUG_STATS, "growing provides hash data...\n"); - pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "growing provides hash data...\n"); + pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id)); pool->whatprovidesdataleft = count + 4096; } @@ -685,7 +685,7 @@ pool_addrelproviders(Pool *pool, Id d) { /* simple version comparison relation */ #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name)); + POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name)); #endif pp = pool_whatprovides_ptr(pool, name); while (ISRELDEP(name)) @@ -740,7 +740,7 @@ pool_addrelproviders(Pool *pool, Id d) } /* add providers to whatprovides */ #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d); + POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d); #endif pool->whatprovides_rel[d] = pool_queuetowhatprovides(pool, &plist); queue_free(&plist); @@ -756,7 +756,7 @@ pool_debug(Pool *pool, int type, const char *format, ...) va_list args; char buf[1024]; - if ((type & (SAT_FATAL|SAT_ERROR)) == 0) + if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0) { if ((pool->debugmask & type) == 0) return; @@ -764,7 +764,7 @@ pool_debug(Pool *pool, int type, const char *format, ...) va_start(args, format); if (!pool->debugcallback) { - if ((type & (SAT_FATAL|SAT_ERROR)) == 0 && !(pool->debugmask & SAT_DEBUG_TO_STDERR)) + if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0 && !(pool->debugmask & SOLV_DEBUG_TO_STDERR)) vprintf(format, args); else vfprintf(stderr, format, args); @@ -777,16 +777,16 @@ pool_debug(Pool *pool, int type, const char *format, ...) void pool_setdebuglevel(Pool *pool, int level) { - int mask = SAT_DEBUG_RESULT; + int mask = SOLV_DEBUG_RESULT; if (level > 0) - mask |= SAT_DEBUG_STATS|SAT_DEBUG_ANALYZE|SAT_DEBUG_UNSOLVABLE|SAT_DEBUG_SOLVER|SAT_DEBUG_TRANSACTION; + mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION; if (level > 1) - mask |= SAT_DEBUG_JOB|SAT_DEBUG_SOLUTIONS|SAT_DEBUG_POLICY; + mask |= SOLV_DEBUG_JOB|SOLV_DEBUG_SOLUTIONS|SOLV_DEBUG_POLICY; if (level > 2) - mask |= SAT_DEBUG_PROPAGATE; + mask |= SOLV_DEBUG_PROPAGATE; if (level > 3) - mask |= SAT_DEBUG_RULE_CREATION; - mask |= pool->debugmask & SAT_DEBUG_TO_STDERR; /* keep bit */ + mask |= SOLV_DEBUG_RULE_CREATION; + mask |= pool->debugmask & SOLV_DEBUG_TO_STDERR; /* keep bit */ pool->debugmask = mask; } @@ -878,13 +878,13 @@ pool_addfileprovides_dep(Pool *pool, Id *ida, struct searchfiles *sf, struct sea s = pool_id2str(pool, dep); if (*s != '/') continue; - csf->ids = sat_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); - csf->dirs = sat_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); - csf->names = sat_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); + csf->ids = solv_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); + csf->dirs = solv_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); + csf->names = solv_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); csf->ids[csf->nfiles] = dep; sr = strrchr(s, '/'); csf->names[csf->nfiles] = strdup(sr + 1); - csf->dirs[csf->nfiles] = sat_malloc(sr - s + 1); + csf->dirs[csf->nfiles] = solv_malloc(sr - s + 1); if (sr != s) strncpy(csf->dirs[csf->nfiles], s, sr - s); csf->dirs[csf->nfiles][sr - s] = 0; @@ -962,7 +962,7 @@ pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, stru cbd->ids = sf->ids; cbd->dirs = sf->dirs; cbd->names = sf->names; - cbd->dids = sat_realloc2(cbd->dids, sf->nfiles, sizeof(Id)); + cbd->dids = solv_realloc2(cbd->dids, sf->nfiles, sizeof(Id)); map_init(&cbd->providedids, pool->ss.nstrings); repoid = 0; @@ -1077,7 +1077,7 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) int i; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); memset(&sf, 0, sizeof(sf)); map_init(&sf.seen, pool->ss.nstrings + pool->nrels); memset(&isf, 0, sizeof(isf)); @@ -1106,7 +1106,7 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) } map_free(&sf.seen); map_free(&isf.seen); - POOL_DEBUG(SAT_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles); + POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles); cbd.dids = 0; if (idp) *idp = 0; @@ -1114,45 +1114,45 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) { #if 0 for (i = 0; i < sf.nfiles; i++) - POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i])); + POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i])); #endif pool_addfileprovides_search(pool, &cbd, &sf, 0); if (idp) { - sf.ids = sat_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); + sf.ids = solv_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); sf.ids[sf.nfiles] = 0; *idp = sf.ids; sf.ids = 0; } - sat_free(sf.ids); + solv_free(sf.ids); for (i = 0; i < sf.nfiles; i++) { - sat_free(sf.dirs[i]); - sat_free(sf.names[i]); + solv_free(sf.dirs[i]); + solv_free(sf.names[i]); } - sat_free(sf.dirs); - sat_free(sf.names); + solv_free(sf.dirs); + solv_free(sf.names); } if (isf.nfiles) { #if 0 for (i = 0; i < isf.nfiles; i++) - POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i])); + POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i])); #endif if (installed) pool_addfileprovides_search(pool, &cbd, &isf, installed); - sat_free(isf.ids); + solv_free(isf.ids); for (i = 0; i < isf.nfiles; i++) { - sat_free(isf.dirs[i]); - sat_free(isf.names[i]); + solv_free(isf.dirs[i]); + solv_free(isf.names[i]); } - sat_free(isf.dirs); - sat_free(isf.names); + solv_free(isf.dirs); + solv_free(isf.names); } - sat_free(cbd.dids); + solv_free(cbd.dids); pool_freewhatprovides(pool); /* as we have added provides */ - POOL_DEBUG(SAT_DEBUG_STATS, "addfileprovides took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "addfileprovides took %d ms\n", solv_timems(now)); } void @@ -1188,7 +1188,7 @@ pool_set_languages(Pool *pool, const char **languages, int nlanguages) { int i; - pool->languagecache = sat_free(pool->languagecache); + pool->languagecache = solv_free(pool->languagecache); pool->languagecacheother = 0; if (pool->nlanguages) { @@ -1199,7 +1199,7 @@ pool_set_languages(Pool *pool, const char **languages, int nlanguages) pool->nlanguages = nlanguages; if (!nlanguages) return; - pool->languages = sat_calloc(nlanguages, sizeof(const char **)); + pool->languages = solv_calloc(nlanguages, sizeof(const char **)); for (i = 0; i < pool->nlanguages; i++) pool->languages[i] = strdup(languages[i]); } @@ -1216,7 +1216,7 @@ pool_id2langid(Pool *pool, Id id, const char *lang, int create) n = pool_id2str(pool, id); l = strlen(n) + strlen(lang) + 2; if (l > sizeof(buf)) - p = sat_malloc(strlen(n) + strlen(lang) + 2); + p = solv_malloc(strlen(n) + strlen(lang) + 2); else p = buf; sprintf(p, "%s:%s", n, lang); @@ -1234,7 +1234,7 @@ pool_alloctmpspace(Pool *pool, int len) return 0; if (len > pool->tmpspace.len[n]) { - pool->tmpspace.buf[n] = sat_realloc(pool->tmpspace.buf[n], len + 32); + pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32); pool->tmpspace.len[n] = len + 32; } pool->tmpspace.n = (n + 1) % POOL_TMPSPACEBUF; @@ -1258,7 +1258,7 @@ pool_alloctmpspace_free(Pool *pool, const char *space, int len) continue; if (len > pool->tmpspace.len[n]) { - pool->tmpspace.buf[n] = sat_realloc(pool->tmpspace.buf[n], len + 32); + pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32); pool->tmpspace.len[n] = len + 32; } return pool->tmpspace.buf[n]; @@ -1348,7 +1348,7 @@ pool_bin2hex(Pool *pool, const unsigned char *buf, int len) if (!len) return ""; s = pool_alloctmpspace(pool, 2 * len + 1); - sat_bin2hex(buf, len, s); + solv_bin2hex(buf, len, s); return s; } @@ -1388,9 +1388,9 @@ solver_fill_DU_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyVa struct mptree *mptree; /* create map from dir to mptree */ - cbd->dirmap = sat_free(cbd->dirmap); + cbd->dirmap = solv_free(cbd->dirmap); cbd->nmap = 0; - dirmap = sat_calloc(data->dirpool.ndirs, sizeof(Id)); + dirmap = solv_calloc(data->dirpool.ndirs, sizeof(Id)); mptree = cbd->mptree; mp = 0; for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++) @@ -1487,7 +1487,7 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) cbd.nmap = 0; cbd.olddata = 0; - mptree = sat_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK); + mptree = solv_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK); /* our root node */ mptree[0].sibling = 0; @@ -1528,7 +1528,7 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) if (!i) { /* create new node */ - mptree = sat_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK); + mptree = solv_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK); i = nmptree++; mptree[i].sibling = mptree[pos].child; mptree[i].child = 0; @@ -1600,8 +1600,8 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) } if (ignoredu.map) map_free(&ignoredu); - sat_free(cbd.dirmap); - sat_free(mptree); + solv_free(cbd.dirmap); + solv_free(mptree); } int @@ -1707,7 +1707,7 @@ pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pk unsigned char *map; Solvable *s; - map = sat_calloc(pool->nsolvables, 1); + map = solv_calloc(pool->nsolvables, 1); for (p = 1; p < pool->nsolvables; p++) { if (!MAPTST(installedmap, p)) diff --git a/src/pool.h b/src/pool.h index 4c53bfa..dcf125c 100644 --- a/src/pool.h +++ b/src/pool.h @@ -19,7 +19,7 @@ extern "C" { #include -#include "satversion.h" +#include "solvversion.h" #include "pooltypes.h" #include "poolid.h" #include "solvable.h" @@ -139,22 +139,22 @@ struct _Pool { # define DISTTYPE_DEB 1 #endif -#define SAT_FATAL (1<<0) -#define SAT_ERROR (1<<1) -#define SAT_WARN (1<<2) -#define SAT_DEBUG_STATS (1<<3) -#define SAT_DEBUG_RULE_CREATION (1<<4) -#define SAT_DEBUG_PROPAGATE (1<<5) -#define SAT_DEBUG_ANALYZE (1<<6) -#define SAT_DEBUG_UNSOLVABLE (1<<7) -#define SAT_DEBUG_SOLUTIONS (1<<8) -#define SAT_DEBUG_POLICY (1<<9) -#define SAT_DEBUG_RESULT (1<<10) -#define SAT_DEBUG_JOB (1<<11) -#define SAT_DEBUG_SOLVER (1<<12) -#define SAT_DEBUG_TRANSACTION (1<<13) - -#define SAT_DEBUG_TO_STDERR (1<<30) +#define SOLV_FATAL (1<<0) +#define SOLV_ERROR (1<<1) +#define SOLV_WARN (1<<2) +#define SOLV_DEBUG_STATS (1<<3) +#define SOLV_DEBUG_RULE_CREATION (1<<4) +#define SOLV_DEBUG_PROPAGATE (1<<5) +#define SOLV_DEBUG_ANALYZE (1<<6) +#define SOLV_DEBUG_UNSOLVABLE (1<<7) +#define SOLV_DEBUG_SOLUTIONS (1<<8) +#define SOLV_DEBUG_POLICY (1<<9) +#define SOLV_DEBUG_RESULT (1<<10) +#define SOLV_DEBUG_JOB (1<<11) +#define SOLV_DEBUG_SOLVER (1<<12) +#define SOLV_DEBUG_TRANSACTION (1<<13) + +#define SOLV_DEBUG_TO_STDERR (1<<30) //----------------------------------------------- diff --git a/src/poolarch.c b/src/poolarch.c index 12fd202..d39cecb 100644 --- a/src/poolarch.c +++ b/src/poolarch.c @@ -90,8 +90,8 @@ pool_setarchpolicy(Pool *pool, const char *arch) Id *id2arch; Id id, lastarch; - pool->id2arch = sat_free(pool->id2arch); - pool->id2color = sat_free(pool->id2color); + pool->id2arch = solv_free(pool->id2arch); + pool->id2color = solv_free(pool->id2color); if (!arch) { pool->lastarch = 0; @@ -103,7 +103,7 @@ pool_setarchpolicy(Pool *pool, const char *arch) id = ARCH_ALL; #endif lastarch = id + 255; - id2arch = sat_calloc(lastarch + 1, sizeof(Id)); + id2arch = solv_calloc(lastarch + 1, sizeof(Id)); id2arch[id] = 1; /* the "noarch" class */ d = 0; @@ -115,7 +115,7 @@ pool_setarchpolicy(Pool *pool, const char *arch) id = pool_strn2id(pool, arch, l, 1); if (id > lastarch) { - id2arch = sat_realloc2(id2arch, (id + 255 + 1), sizeof(Id)); + id2arch = solv_realloc2(id2arch, (id + 255 + 1), sizeof(Id)); memset(id2arch + lastarch + 1, 0, (id + 255 - lastarch) * sizeof(Id)); lastarch = id + 255; } @@ -145,7 +145,7 @@ pool_arch2color_slow(Pool *pool, Id arch) if (arch > pool->lastarch) return ARCHCOLOR_ALL; if (!pool->id2color) - pool->id2color = sat_calloc(pool->lastarch + 1, 1); + pool->id2color = solv_calloc(pool->lastarch + 1, 1); s = pool_id2str(pool, arch); if (arch == ARCH_NOARCH || arch == ARCH_ALL) color = ARCHCOLOR_ALL; diff --git a/src/poolid.c b/src/poolid.c index d5f6bb2..bf8d18b 100644 --- a/src/poolid.c +++ b/src/poolid.c @@ -31,7 +31,7 @@ pool_str2id(Pool *pool, const char *str, int create) if (create && pool->whatprovides && oldnstrings != pool->ss.nstrings && (id & WHATPROVIDES_BLOCK) == 0) { /* grow whatprovides array */ - pool->whatprovides = sat_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); + pool->whatprovides = solv_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); memset(pool->whatprovides + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return id; @@ -45,7 +45,7 @@ pool_strn2id(Pool *pool, const char *str, unsigned int len, int create) if (create && pool->whatprovides && oldnstrings != pool->ss.nstrings && (id & WHATPROVIDES_BLOCK) == 0) { /* grow whatprovides array */ - pool->whatprovides = sat_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); + pool->whatprovides = solv_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); memset(pool->whatprovides + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return id; @@ -69,9 +69,9 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) /* extend hashtable if needed */ if (pool->nrels * 2 > hashmask) { - sat_free(pool->relhashtbl); + solv_free(pool->relhashtbl); pool->relhashmask = hashmask = mkmask(pool->nrels + REL_BLOCK); - pool->relhashtbl = hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + pool->relhashtbl = hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); // rehash all rels into new hashtable for (i = 1; i < pool->nrels; i++) { @@ -100,7 +100,7 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) id = pool->nrels++; /* extend rel space if needed */ - pool->rels = sat_extend(pool->rels, id, 1, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend(pool->rels, id, 1, sizeof(Reldep), REL_BLOCK); hashtbl[h] = id; ran = pool->rels + id; ran->name = name; @@ -110,7 +110,7 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) /* extend whatprovides_rel if needed */ if (pool->whatprovides_rel && (id & WHATPROVIDES_BLOCK) == 0) { - pool->whatprovides_rel = sat_realloc2(pool->whatprovides_rel, id + (WHATPROVIDES_BLOCK + 1), sizeof(Offset)); + pool->whatprovides_rel = solv_realloc2(pool->whatprovides_rel, id + (WHATPROVIDES_BLOCK + 1), sizeof(Offset)); memset(pool->whatprovides_rel + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return MAKERELDEP(id); @@ -275,7 +275,7 @@ pool_shrink_strings(Pool *pool) void pool_shrink_rels(Pool *pool) { - pool->rels = sat_extend_resize(pool->rels, pool->nrels, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend_resize(pool->rels, pool->nrels, sizeof(Reldep), REL_BLOCK); } // reset all hash tables @@ -284,7 +284,7 @@ void pool_freeidhashes(Pool *pool) { stringpool_freehash(&pool->ss); - pool->relhashtbl = sat_free(pool->relhashtbl); + pool->relhashtbl = solv_free(pool->relhashtbl); pool->relhashmask = 0; } diff --git a/src/poolvendor.c b/src/poolvendor.c index 04180b9..f621f50 100644 --- a/src/poolvendor.c +++ b/src/poolvendor.c @@ -88,14 +88,14 @@ pool_setvendorclasses(Pool *pool, const char **vendorclasses) if (pool->vendorclasses) { for (v = pool->vendorclasses; v[0] || v[1]; v++) - sat_free((void *)*v); - pool->vendorclasses = sat_free(pool->vendorclasses); + solv_free((void *)*v); + pool->vendorclasses = solv_free(pool->vendorclasses); } if (!vendorclasses || !vendorclasses[0]) return; for (v = vendorclasses; v[0] || v[1]; v++) ; - pool->vendorclasses = sat_calloc(v - vendorclasses + 2, sizeof(const char *)); + pool->vendorclasses = solv_calloc(v - vendorclasses + 2, sizeof(const char *)); for (v = vendorclasses, i = 0; v[0] || v[1]; v++, i++) pool->vendorclasses[i] = *v ? strdup(*v) : 0; pool->vendorclasses[i++] = 0; diff --git a/src/problems.c b/src/problems.c index 14e64b9..1d9689c 100644 --- a/src/problems.c +++ b/src/problems.c @@ -183,13 +183,13 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti Queue disabled; int disabledcnt; - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion start\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "refine_suggestion start\n"); for (i = 0; problem[i]; i++) { if (problem[i] == sug) - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "=> "); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "=> "); solver_printproblem(solv, problem[i]); } } @@ -229,7 +229,7 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti if (!solv->problems.count) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no more problems!\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "no more problems!\n"); break; /* great, no more problems */ } disabledcnt = disabled.count; @@ -261,14 +261,14 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti if (disabled.count == disabledcnt) { /* no solution found, this was an invalid suggestion! */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no solution found!\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "no solution found!\n"); refined->count = 0; break; } if (!njob && nupdate && nfeature) { /* got only update rules, filter out feature rules */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "throwing away feature rules\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "throwing away feature rules\n"); for (i = j = disabledcnt; i < disabled.count; i++) { v = disabled.elements[i]; @@ -300,9 +300,9 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti /* do not push anything on refine list, as we do not know which solution to choose */ /* thus, the user will get another problem if he selects this solution, where he * can choose the right one */ - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "more than one solution found:\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "more than one solution found:\n"); for (i = disabledcnt; i < disabled.count; i++) solver_printproblem(solv, disabled.elements[i]); } @@ -331,7 +331,7 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti /* disable problem rules again */ for (i = 0; problem[i]; i++) solver_disableproblem(solv, problem[i]); - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion end\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "refine_suggestion end\n"); } @@ -516,7 +516,7 @@ create_solutions(Solver *solv, int probnr, int solidx) int recocount; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); recocount = solv->recommendations.count; solv->recommendations.count = 0; /* so that revert() doesn't mess with it later */ queue_init(&redoq); @@ -542,7 +542,7 @@ create_solutions(Solver *solv, int probnr, int solidx) queue_push(&problem, v); } if (problem.count > 1) - sat_sort(problem.elements, problem.count, sizeof(Id), problems_sortcmp, &solv->job); + solv_sort(problem.elements, problem.count, sizeof(Id), problems_sortcmp, &solv->job); queue_push(&problem, 0); /* mark end for refine_suggestion */ problem.count--; #if 0 @@ -569,14 +569,14 @@ create_solutions(Solver *solv, int probnr, int solidx) if (!essentialok) { /* nothing found, start over */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "nothing found, re-run with essentialok = 1\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "nothing found, re-run with essentialok = 1\n"); essentialok = 1; i = -1; continue; } /* this is bad, we found no solution */ /* for now just offer a rule */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "nothing found, already did essentialok, fake it\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "nothing found, already did essentialok, fake it\n"); queue_push(&solv->solutions, 0); for (j = 0; j < problem.count; j++) { @@ -619,7 +619,7 @@ create_solutions(Solver *solv, int probnr, int solidx) /* restore problems */ queue_free(&solv->problems); solv->problems = problems_save; - POOL_DEBUG(SAT_DEBUG_STATS, "create_solutions for problem #%d took %d ms\n", probnr, sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "create_solutions for problem #%d took %d ms\n", probnr, solv_timems(now)); } diff --git a/src/qsort_r.c b/src/qsort_r.c index 7911ec5..c4bc6d2 100644 --- a/src/qsort_r.c +++ b/src/qsort_r.c @@ -96,7 +96,7 @@ med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk) } void -sat_sort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) +solv_sort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; size_t d, r; @@ -168,7 +168,7 @@ loop: SWAPINIT(a, es); r = min(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) - sat_sort(a, r / es, es, cmp, thunk); + solv_sort(a, r / es, es, cmp, thunk); if ((r = pd - pc) > es) { /* Iterate rather than recurse to save stack space */ a = pn - r; diff --git a/src/queue.c b/src/queue.c index d22c382..4fe0799 100644 --- a/src/queue.c +++ b/src/queue.c @@ -35,7 +35,7 @@ queue_init_clone(Queue *t, Queue *s) t->count = t->left = 0; return; } - t->alloc = t->elements = sat_malloc2(s->count + EXTRA_SPACE, sizeof(Id)); + t->alloc = t->elements = solv_malloc2(s->count + EXTRA_SPACE, sizeof(Id)); if (s->count) memcpy(t->alloc, s->elements, s->count * sizeof(Id)); t->count = s->count; @@ -55,7 +55,7 @@ void queue_free(Queue *q) { if (q->alloc) - sat_free(q->alloc); + solv_free(q->alloc); q->alloc = q->elements = 0; q->count = q->left = 0; } @@ -65,7 +65,7 @@ queue_alloc_one(Queue *q) { if (!q->alloc) { - q->alloc = sat_malloc2(q->count + EXTRA_SPACE, sizeof(Id)); + q->alloc = solv_malloc2(q->count + EXTRA_SPACE, sizeof(Id)); if (q->count) memcpy(q->alloc, q->elements, q->count * sizeof(Id)); q->elements = q->alloc; @@ -81,7 +81,7 @@ queue_alloc_one(Queue *q) } else { - q->elements = q->alloc = sat_realloc2(q->alloc, q->count + EXTRA_SPACE, sizeof(Id)); + q->elements = q->alloc = solv_realloc2(q->alloc, q->count + EXTRA_SPACE, sizeof(Id)); q->left = EXTRA_SPACE; } } @@ -165,7 +165,7 @@ queue_insertn(Queue *q, int pos, int n) if (!q->alloc) queue_alloc_one(q); off = q->elements - q->alloc; - q->alloc = sat_realloc2(q->alloc, off + q->count + n + EXTRA_SPACE, sizeof(Id)); + q->alloc = solv_realloc2(q->alloc, off + q->count + n + EXTRA_SPACE, sizeof(Id)); q->elements = q->alloc + off; q->left = n + EXTRA_SPACE; } diff --git a/src/repo.c b/src/repo.c index 25af8b4..3858ff8 100644 --- a/src/repo.c +++ b/src/repo.c @@ -41,8 +41,8 @@ repo_create(Pool *pool, const char *name) Repo *repo; pool_freewhatprovides(pool); - repo = (Repo *)sat_calloc(1, sizeof(*repo)); - pool->repos = (Repo **)sat_realloc2(pool->repos, pool->nrepos + 1, sizeof(Repo *)); + repo = (Repo *)solv_calloc(1, sizeof(*repo)); + pool->repos = (Repo **)solv_realloc2(pool->repos, pool->nrepos + 1, sizeof(Repo *)); pool->repos[pool->nrepos++] = repo; repo->repoid = pool->nrepos; repo->name = name ? strdup(name) : 0; @@ -59,11 +59,11 @@ repo_freedata(Repo *repo) int i; for (i = 0; i < repo->nrepodata; i++) repodata_freedata(repo->repodata + i); - sat_free(repo->repodata); - sat_free(repo->idarraydata); - sat_free(repo->rpmdbid); - sat_free((char *)repo->name); - sat_free(repo); + solv_free(repo->repodata); + solv_free(repo->idarraydata); + solv_free(repo->rpmdbid); + solv_free((char *)repo->name); + solv_free(repo); } /* delete all solvables and repodata blocks from this repo */ @@ -92,13 +92,13 @@ repo_empty(Repo *repo, int reuseids) repo->nsolvables = 0; /* free all data belonging to this repo */ - repo->idarraydata = sat_free(repo->idarraydata); + repo->idarraydata = solv_free(repo->idarraydata); repo->idarraysize = 0; repo->lastoff = 0; - repo->rpmdbid = sat_free(repo->rpmdbid); + repo->rpmdbid = solv_free(repo->rpmdbid); for (i = 0; i < repo->nrepodata; i++) repodata_freedata(repo->repodata + i); - sat_free(repo->repodata); + solv_free(repo->repodata); repo->repodata = 0; repo->nrepodata = 0; } @@ -141,7 +141,7 @@ repo_freeallrepos(Pool *pool, int reuseids) pool_freewhatprovides(pool); for (i = 0; i < pool->nrepos; i++) repo_freedata(pool->repos[i]); - pool->repos = sat_free(pool->repos); + pool->repos = solv_free(pool->repos); pool->nrepos = 0; /* the first two solvables don't belong to a repo */ pool_free_solvable_block(pool, 2, pool->nsolvables - 2, reuseids); @@ -220,7 +220,7 @@ void repo_free_solvable_block(Repo *repo, Id start, int count, int reuseids) void * repo_sidedata_create(Repo *repo, size_t size) { - return sat_calloc_block(repo->end - repo->start, size, REPO_SIDEDATA_BLOCK); + return solv_calloc_block(repo->end - repo->start, size, REPO_SIDEDATA_BLOCK); } void * @@ -230,7 +230,7 @@ repo_sidedata_extend(Repo *repo, void *b, size_t size, Id p, int count) if (p < repo->start) { int d = repo->start - p; - b = sat_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); + b = solv_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); memmove((char *)b + d * size, b, n * size); memset(b, 0, d * size); n += d; @@ -238,7 +238,7 @@ repo_sidedata_extend(Repo *repo, void *b, size_t size, Id p, int count) if (p + count > repo->end) { int d = p + count - repo->end; - b = sat_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); + b = solv_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); memset((char *)b + n * size, 0, d * size); } return b; @@ -263,7 +263,7 @@ repo_addid(Repo *repo, Offset olddeps, Id id) if (!idarray) /* alloc idarray if not done yet */ { idarraysize = 1; - idarray = sat_extend_resize(0, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend_resize(0, 1, sizeof(Id), IDARRAY_BLOCK); idarray[0] = 0; repo->lastoff = 0; } @@ -271,7 +271,7 @@ repo_addid(Repo *repo, Offset olddeps, Id id) if (!olddeps) /* no deps yet */ { olddeps = idarraysize; - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); } else if (olddeps == repo->lastoff) /* extend at end */ idarraysize--; @@ -281,14 +281,14 @@ repo_addid(Repo *repo, Offset olddeps, Id id) olddeps = idarraysize; for (; idarray[i]; i++) { - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); idarray[idarraysize++] = idarray[i]; } - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); } idarray[idarraysize++] = id; /* insert Id into array */ - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); idarray[idarraysize++] = 0; /* ensure NULL termination */ repo->idarraydata = idarray; @@ -400,7 +400,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) if (!repo->idarraysize) /* ensure buffer space */ { repo->idarraysize = 1; - repo->idarraydata = sat_extend_resize(0, 1 + num, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend_resize(0, 1 + num, sizeof(Id), IDARRAY_BLOCK); repo->idarraydata[0] = 0; repo->lastoff = 1; return 1; @@ -420,7 +420,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) ; count = idend - idstart - 1 + num; /* new size */ - repo->idarraydata = sat_extend(repo->idarraydata, repo->idarraysize, count, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend(repo->idarraydata, repo->idarraysize, count, sizeof(Id), IDARRAY_BLOCK); /* move old deps to end */ olddeps = repo->lastoff = repo->idarraysize; memcpy(repo->idarraydata + olddeps, idstart, count - num); @@ -433,7 +433,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) repo->idarraysize--; /* make room*/ - repo->idarraydata = sat_extend(repo->idarraydata, repo->idarraysize, num, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend(repo->idarraydata, repo->idarraysize, num, sizeof(Id), IDARRAY_BLOCK); /* appending or new */ repo->lastoff = olddeps ? olddeps : repo->idarraysize; @@ -1093,7 +1093,7 @@ const char * repo_lookup_checksum(Repo *repo, Id entry, Id keyname, Id *typep) { const unsigned char *chk = repo_lookup_bin_checksum(repo, entry, keyname, typep); - return chk ? pool_bin2hex(repo->pool, chk, sat_chksum_len(*typep)) : 0; + return chk ? pool_bin2hex(repo->pool, chk, solv_chksum_len(*typep)) : 0; } int diff --git a/src/repo_solv.c b/src/repo_solv.c index a3ea500..6c21584 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -64,7 +64,7 @@ read_u32(Repodata *data) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -88,7 +88,7 @@ read_u8(Repodata *data) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -113,7 +113,7 @@ read_id(Repodata *data, Id max) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -122,7 +122,7 @@ read_id(Repodata *data, Id max) x = (x << 7) | c; if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "read_id: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "read_id: id too large (%u/%u)\n", x, max); data->error = SOLV_ERROR_ID_RANGE; return 0; } @@ -130,7 +130,7 @@ read_id(Repodata *data, Id max) } x = (x << 7) ^ c ^ 128; } - pool_debug(mypool, SAT_ERROR, "read_id: id too long\n"); + pool_debug(mypool, SOLV_ERROR, "read_id: id too long\n"); data->error = SOLV_ERROR_CORRUPT; return 0; } @@ -149,7 +149,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -161,7 +161,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) x = (x << 6) | (c & 63); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "read_idarray: id too large (%u/%u)\n", x, max); data->error = SOLV_ERROR_ID_RANGE; return 0; } @@ -169,7 +169,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) x = map[x]; if (store == end) { - pool_debug(mypool, SAT_ERROR, "read_idarray: array overflow\n"); + pool_debug(mypool, SOLV_ERROR, "read_idarray: array overflow\n"); return 0; } *store++ = x; @@ -179,7 +179,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) return store; if (store == end) { - pool_debug(mypool, SAT_ERROR, "read_idarray: array overflow\n"); + pool_debug(mypool, SOLV_ERROR, "read_idarray: array overflow\n"); data->error = SOLV_ERROR_OVERFLOW; return 0; } @@ -206,7 +206,7 @@ data_read_id_max(unsigned char *dp, Id *ret, Id *map, int max, int *error) dp = data_read_id(dp, &x); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; x = 0; } @@ -232,7 +232,7 @@ data_read_idarray(unsigned char *dp, Id **storep, Id *map, int max, int *error) x = (x << 6) | (c & 63); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; break; } @@ -276,7 +276,7 @@ data_read_rel_idarray(unsigned char *dp, Id **storep, Id *map, int max, int *err old = x; if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_rel_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_rel_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; break; } @@ -307,7 +307,7 @@ incore_add_id(Repodata *data, Id x) /* make sure we have at least 5 bytes free */ if (data->incoredatafree < 5) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); data->incoredatafree = INCORE_ADD_CHUNK; } dp = data->incoredata + data->incoredatalen; @@ -333,7 +333,7 @@ incore_add_blob(Repodata *data, unsigned char *buf, int len) { if (data->incoredatafree < len) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK + len); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK + len); data->incoredatafree = INCORE_ADD_CHUNK + len; } memcpy(data->incoredata + data->incoredatalen, buf, len); @@ -354,7 +354,7 @@ incore_map_idarray(Repodata *data, unsigned char *dp, Id *map, Id max) dp = data_read_ideof(dp, &id, &eof); if (max && id >= max) { - pool_debug(mypool, SAT_ERROR, "incore_map_idarray: id too large (%u/%u)\n", id, max); + pool_debug(mypool, SOLV_ERROR, "incore_map_idarray: id too large (%u/%u)\n", id, max); data->error = SOLV_ERROR_ID_RANGE; break; } @@ -374,7 +374,7 @@ incore_add_u32(Repodata *data, unsigned int x) /* make sure we have at least 4 bytes free */ if (data->incoredatafree < 4) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); data->incoredatafree = INCORE_ADD_CHUNK; } dp = data->incoredata + data->incoredatalen; @@ -394,7 +394,7 @@ incore_add_u8(Repodata *data, unsigned int x) /* make sure we have at least 1 byte free */ if (data->incoredatafree < 1) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + 1024); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + 1024); data->incoredatafree = 1024; } dp = data->incoredata + data->incoredatalen; @@ -456,7 +456,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) Repodata *parent = 0; Repodata data; - now = sat_timems(0); + now = solv_timems(0); if ((flags & REPO_USE_LOADING) != 0) { @@ -475,7 +475,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (read_u32(&data) != ('S' << 24 | 'O' << 16 | 'L' << 8 | 'V')) { - pool_debug(pool, SAT_ERROR, "not a SOLV file\n"); + pool_debug(pool, SOLV_ERROR, "not a SOLV file\n"); return SOLV_ERROR_NOT_SOLV; } solvversion = read_u32(&data); @@ -484,7 +484,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) case SOLV_VERSION_8: break; default: - pool_debug(pool, SAT_ERROR, "unsupported SOLV version\n"); + pool_debug(pool, SOLV_ERROR, "unsupported SOLV version\n"); return SOLV_ERROR_UNSUPPORTED; } @@ -500,13 +500,13 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (numdir && numdir < 2) { - pool_debug(pool, SAT_ERROR, "bad number of dirs\n"); + pool_debug(pool, SOLV_ERROR, "bad number of dirs\n"); return SOLV_ERROR_CORRUPT; } if (numrel && (flags & REPO_LOCALPOOL) != 0) { - pool_debug(pool, SAT_ERROR, "relations are forbidden in a local pool\n"); + pool_debug(pool, SOLV_ERROR, "relations are forbidden in a local pool\n"); return SOLV_ERROR_CORRUPT; } if (parent && numsolv) @@ -514,13 +514,13 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* make sure that we exactly replace the stub repodata */ if (parent->end - parent->start != numsolv) { - pool_debug(pool, SAT_ERROR, "sub-repository solvable number does not match main repository (%d - %d)\n", parent->end - parent->start, numsolv); + pool_debug(pool, SOLV_ERROR, "sub-repository solvable number does not match main repository (%d - %d)\n", parent->end - parent->start, numsolv); return SOLV_ERROR_CORRUPT; } for (i = 0; i < numsolv; i++) if (pool->solvables[parent->start + i].repo != repo) { - pool_debug(pool, SAT_ERROR, "main repository contains holes\n"); + pool_debug(pool, SOLV_ERROR, "main repository contains holes\n"); return SOLV_ERROR_CORRUPT; } } @@ -545,16 +545,16 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { data.localpool = 1; spool = &data.spool; - spool->stringspace = sat_malloc(7); + spool->stringspace = solv_malloc(7); strcpy(spool->stringspace, ""); spool->sstrings = 7; spool->nstrings = 0; } /* alloc string buffer */ - spool->stringspace = sat_realloc(spool->stringspace, spool->sstrings + sizeid + 1); + spool->stringspace = solv_realloc(spool->stringspace, spool->sstrings + sizeid + 1); /* alloc string offsets (Id -> Offset into string space) */ - spool->strings = sat_realloc2(spool->strings, spool->nstrings + numid, sizeof(Offset)); + spool->strings = solv_realloc2(spool->strings, spool->nstrings + numid, sizeof(Offset)); strsp = spool->stringspace; str = spool->strings; /* array of offsets into strsp, indexed by Id */ @@ -571,14 +571,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { if (sizeid && fread(strsp, sizeid, 1, fp) != 1) { - pool_debug(pool, SAT_ERROR, "read error while reading strings\n"); + pool_debug(pool, SOLV_ERROR, "read error while reading strings\n"); return SOLV_ERROR_EOF; } } else { unsigned int pfsize = read_u32(&data); - char *prefix = sat_malloc(pfsize); + char *prefix = solv_malloc(pfsize); char *pp = prefix; char *old_str = 0; char *dest = strsp; @@ -586,8 +586,8 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (pfsize && fread(prefix, pfsize, 1, fp) != 1) { - pool_debug(pool, SAT_ERROR, "read error while reading strings\n"); - sat_free(prefix); + pool_debug(pool, SOLV_ERROR, "read error while reading strings\n"); + solv_free(prefix); return SOLV_ERROR_EOF; } for (i = 1; i < numid; i++) @@ -597,8 +597,8 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) freesp -= same + len; if (freesp < 0) { - pool_debug(pool, SAT_ERROR, "overflow while expanding strings\n"); - sat_free(prefix); + pool_debug(pool, SOLV_ERROR, "overflow while expanding strings\n"); + solv_free(prefix); return SOLV_ERROR_OVERFLOW; } if (same) @@ -608,10 +608,10 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) old_str = dest; dest += same + len; } - sat_free(prefix); + solv_free(prefix); if (freesp != 0) { - pool_debug(pool, SAT_ERROR, "expanding strings size mismatch\n"); + pool_debug(pool, SOLV_ERROR, "expanding strings size mismatch\n"); return SOLV_ERROR_CORRUPT; } } @@ -627,14 +627,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (*sp) { /* we need the '' for directories */ - pool_debug(pool, SAT_ERROR, "store strings don't start with ''\n"); + pool_debug(pool, SOLV_ERROR, "store strings don't start with ''\n"); return SOLV_ERROR_CORRUPT; } for (i = 1; i < spool->nstrings; i++) { if (sp >= strsp + sizeid) { - pool_debug(pool, SAT_ERROR, "not enough strings\n"); + pool_debug(pool, SOLV_ERROR, "not enough strings\n"); return SOLV_ERROR_OVERFLOW; } str[i] = sp - spool->stringspace; @@ -647,7 +647,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* alloc id map for name and rel Ids. this maps ids in the solv files * to the ids in our pool */ - idmap = sat_calloc(numid + numrel, sizeof(Id)); + idmap = solv_calloc(numid + numrel, sizeof(Id)); /* * build hashes for all read strings @@ -657,15 +657,15 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) hashmask = mkmask(spool->nstrings + numid); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "read %d strings\n", numid); - POOL_DEBUG(SAT_DEBUG_STATS, "string hash buckets: %d\n", hashmask + 1); + POOL_DEBUG(SOLV_DEBUG_STATS, "read %d strings\n", numid); + POOL_DEBUG(SOLV_DEBUG_STATS, "string hash buckets: %d\n", hashmask + 1); #endif /* * create hashtable with strings already in pool */ - hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); for (i = 1; i < spool->nstrings; i++) /* leave out our dummy zero id */ { h = strhash(spool->stringspace + spool->strings[i]) & hashmask; @@ -685,9 +685,9 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { if (sp >= strsp + sizeid) { - sat_free(hashtbl); - sat_free(idmap); - pool_debug(pool, SAT_ERROR, "not enough strings %d %d\n", i, numid); + solv_free(hashtbl); + solv_free(idmap); + pool_debug(pool, SOLV_ERROR, "not enough strings %d %d\n", i, numid); return SOLV_ERROR_OVERFLOW; } if (!*sp) /* empty string */ @@ -724,7 +724,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) idmap[i] = id; /* repo relative -> pool relative */ sp += l; /* next string */ } - sat_free(hashtbl); + solv_free(hashtbl); } pool_shrink_strings(pool); /* vacuum */ @@ -739,19 +739,19 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (numrel) { /* extend rels */ - pool->rels = sat_realloc2(pool->rels, pool->nrels + numrel, sizeof(Reldep)); + pool->rels = solv_realloc2(pool->rels, pool->nrels + numrel, sizeof(Reldep)); ran = pool->rels; hashmask = mkmask(pool->nrels + numrel); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "read %d rels\n", numrel); - POOL_DEBUG(SAT_DEBUG_STATS, "rel hash buckets: %d\n", hashmask + 1); + POOL_DEBUG(SOLV_DEBUG_STATS, "read %d rels\n", numrel); + POOL_DEBUG(SOLV_DEBUG_STATS, "rel hash buckets: %d\n", hashmask + 1); #endif /* * prep hash table with already existing RelDeps */ - hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); for (i = 1; i < pool->nrels; i++) { h = relhash(ran[i].name, ran[i].evr, ran[i].flags) & hashmask; @@ -793,7 +793,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) } idmap[i + numid] = MAKERELDEP(id); /* fill Id map */ } - sat_free(hashtbl); + solv_free(hashtbl); pool_shrink_rels(pool); /* vacuum */ } @@ -801,7 +801,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 3: Dirs ***********************************************/ if (numdir) { - data.dirpool.dirs = sat_malloc2(numdir, sizeof(Id)); + data.dirpool.dirs = solv_malloc2(numdir, sizeof(Id)); data.dirpool.ndirs = numdir; data.dirpool.dirs[0] = 0; /* dir 0: virtual root */ data.dirpool.dirs[1] = 1; /* dir 1: / */ @@ -819,7 +819,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 4: Keys ***********************************************/ - keys = sat_calloc(numkeys, sizeof(*keys)); + keys = solv_calloc(numkeys, sizeof(*keys)); /* keys start at 1 */ for (i = 1; i < numkeys; i++) { @@ -835,7 +835,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) type = pool_str2id(pool, stringpool_id2str(spool, type), 1); if (type < REPOKEY_TYPE_VOID || type > REPOKEY_TYPE_FLEXARRAY) { - pool_debug(pool, SAT_ERROR, "unsupported data type '%s'\n", pool_id2str(pool, type)); + pool_debug(pool, SOLV_ERROR, "unsupported data type '%s'\n", pool_id2str(pool, type)); data.error = SOLV_ERROR_UNSUPPORTED; type = REPOKEY_TYPE_VOID; } @@ -848,14 +848,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) keys[i].storage = KEY_STORAGE_INCORE; if (keys[i].storage != KEY_STORAGE_INCORE && keys[i].storage != KEY_STORAGE_VERTICAL_OFFSET) { - pool_debug(pool, SAT_ERROR, "unsupported storage type %d\n", keys[i].storage); + pool_debug(pool, SOLV_ERROR, "unsupported storage type %d\n", keys[i].storage); data.error = SOLV_ERROR_UNSUPPORTED; } if (id >= SOLVABLE_NAME && id <= RPM_RPMDBID) { if (keys[i].storage != KEY_STORAGE_INCORE) { - pool_debug(pool, SAT_ERROR, "main solvable data must use incore storage%d\n", keys[i].storage); + pool_debug(pool, SOLV_ERROR, "main solvable data must use incore storage%d\n", keys[i].storage); data.error = SOLV_ERROR_UNSUPPORTED; } keys[i].storage = KEY_STORAGE_SOLVABLE; @@ -863,7 +863,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* cannot handle rel idarrays in incore/vertical */ if (type == REPOKEY_TYPE_REL_IDARRAY && keys[i].storage != KEY_STORAGE_SOLVABLE) { - pool_debug(pool, SAT_ERROR, "type REL_IDARRAY only supported for STORAGE_SOLVABLE\n"); + pool_debug(pool, SOLV_ERROR, "type REL_IDARRAY only supported for STORAGE_SOLVABLE\n"); data.error = SOLV_ERROR_UNSUPPORTED; } if (keys[i].type == REPOKEY_TYPE_CONSTANTID && idmap) @@ -890,10 +890,10 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 5: Schemata ********************************************/ id = read_id(&data, 0); - schemadata = sat_calloc(id + 1, sizeof(Id)); + schemadata = solv_calloc(id + 1, sizeof(Id)); schemadatap = schemadata + 1; schemadataend = schemadatap + id; - schemata = sat_calloc(numschemata, sizeof(Id)); + schemata = solv_calloc(numschemata, sizeof(Id)); for (i = 1; i < numschemata; i++) { schemata[i] = schemadatap - schemadata; @@ -922,7 +922,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (maxsize > allsize) maxsize = allsize; - buf = sat_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */ + buf = solv_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */ bufend = buf; dp = buf; @@ -933,7 +933,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) l = allsize; if (!l || fread(buf, l, 1, data.fp) != 1) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data.error = SOLV_ERROR_EOF; id = 0; } @@ -951,7 +951,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) for (i = 0; keyp[i]; i++) ; if (i) - data.mainschemaoffsets = sat_calloc(i, sizeof(Id)); + data.mainschemaoffsets = solv_calloc(i, sizeof(Id)); nentries = 0; keydepth = 0; @@ -968,7 +968,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) break; if (left < 0) { - pool_debug(mypool, SAT_ERROR, "buffer overrun\n"); + pool_debug(mypool, SOLV_ERROR, "buffer overrun\n"); data.error = SOLV_ERROR_EOF; break; } @@ -983,7 +983,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) l = allsize; if (l && fread(buf + left, l, 1, data.fp) != 1) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data.error = SOLV_ERROR_EOF; break; } @@ -1066,13 +1066,13 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else if (keys[key].storage == KEY_STORAGE_INCORE) incore_add_id(&data, did); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %s\n", pool_id2str(pool, id), pool_id2str(pool, did)); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s -> %s\n", pool_id2str(pool, id), pool_id2str(pool, did)); #endif break; case REPOKEY_TYPE_U32: dp = data_read_u32(dp, &h); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %u\n", pool_id2str(pool, id), h); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s -> %u\n", pool_id2str(pool, id), h); #endif if (s && id == RPM_RPMDBID) { @@ -1108,7 +1108,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key dp = data_read_rel_idarray(dp, &idarraydatap, idmap, numid + numrel, &data.error, 0); if (idarraydatap > idarraydataend) { - pool_debug(pool, SAT_ERROR, "idarray overflow\n"); + pool_debug(pool, SOLV_ERROR, "idarray overflow\n"); data.error = SOLV_ERROR_OVERFLOW; break; } @@ -1129,9 +1129,9 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else if (id == SOLVABLE_ENHANCES) s->enhances = ido; #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s ->\n", pool_id2str(pool, id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s ->\n", pool_id2str(pool, id)); for (; repo->idarraydata[ido]; ido++) - POOL_DEBUG(SAT_DEBUG_STATS," %s\n", pool_dep2str(pool, repo->idarraydata[ido])); + POOL_DEBUG(SOLV_DEBUG_STATS," %s\n", pool_dep2str(pool, repo->idarraydata[ido])); #endif break; case REPOKEY_TYPE_FIXARRAY: @@ -1140,7 +1140,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key needchunk = 1; if (keydepth == sizeof(stack)/sizeof(*stack)) { - pool_debug(pool, SAT_ERROR, "array stack overflow\n"); + pool_debug(pool, SOLV_ERROR, "array stack overflow\n"); data.error = SOLV_ERROR_CORRUPT; break; } @@ -1161,13 +1161,13 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* horray! here come the solvables */ if (nentries != numsolv) { - pool_debug(pool, SAT_ERROR, "inconsistent number of solvables: %d %d\n", nentries, numsolv); + pool_debug(pool, SOLV_ERROR, "inconsistent number of solvables: %d %d\n", nentries, numsolv); data.error = SOLV_ERROR_CORRUPT; break; } if (idarraydatap) { - pool_debug(pool, SAT_ERROR, "more than one solvable block\n"); + pool_debug(pool, SOLV_ERROR, "more than one solvable block\n"); data.error = SOLV_ERROR_CORRUPT; break; } @@ -1202,7 +1202,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key { if (!id) { - pool_debug(pool, SAT_ERROR, "illegal fixarray\n"); + pool_debug(pool, SOLV_ERROR, "illegal fixarray\n"); data.error = SOLV_ERROR_CORRUPT; } stack[keydepth - 1] = id; @@ -1221,18 +1221,18 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key if (keydepth) { - pool_debug(pool, SAT_ERROR, "unexpected EOF, depth = %d\n", keydepth); + pool_debug(pool, SOLV_ERROR, "unexpected EOF, depth = %d\n", keydepth); data.error = SOLV_ERROR_CORRUPT; } if (!data.error) { if (dp > bufend) { - pool_debug(mypool, SAT_ERROR, "buffer overrun\n"); + pool_debug(mypool, SOLV_ERROR, "buffer overrun\n"); data.error = SOLV_ERROR_EOF; } } - sat_free(buf); + solv_free(buf); if (data.error) { @@ -1241,14 +1241,14 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* free id array */ repo->idarraysize -= size_idarray; /* free incore data */ - data.incoredata = sat_free(data.incoredata); + data.incoredata = solv_free(data.incoredata); data.incoredatalen = data.incoredatafree = 0; } if (data.incoredatafree) { /* shrink excess size */ - data.incoredata = sat_realloc(data.incoredata, data.incoredatalen); + data.incoredata = solv_realloc(data.incoredata, data.incoredatalen); data.incoredatafree = 0; } @@ -1261,7 +1261,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key unsigned int pagesize; /* we have vertical data, make it available */ - data.verticaloffset = sat_calloc(numkeys, sizeof(Id)); + data.verticaloffset = solv_calloc(numkeys, sizeof(Id)); for (i = 1; i < numkeys; i++) if (keys[i].storage == KEY_STORAGE_VERTICAL_OFFSET) { @@ -1277,7 +1277,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* no longer needed */ data.fp = 0; } - sat_free(idmap); + solv_free(idmap); mypool = 0; if (data.error) @@ -1295,7 +1295,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else { /* make it available as new repodata */ - repo->repodata = sat_realloc2(repo->repodata, repo->nrepodata + 1, sizeof(data)); + repo->repodata = solv_realloc2(repo->repodata, repo->nrepodata + 1, sizeof(data)); repo->repodata[repo->nrepodata++] = data; } @@ -1309,9 +1309,9 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key repodata_create_stubs(repo->repodata + (repo->nrepodata - 1)); } - POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_solv took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data.incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_solv took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data.incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); return 0; } diff --git a/src/repodata.c b/src/repodata.c index 55517c5..d3b00f6 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -47,10 +47,10 @@ repodata_initdata(Repodata *data, Repo *repo, int localpool) if (localpool) stringpool_init_empty(&data->spool); /* dirpool_init(&data->dirpool); just zeros out again */ - data->keys = sat_calloc(1, sizeof(Repokey)); + data->keys = solv_calloc(1, sizeof(Repokey)); data->nkeys = 1; - data->schemata = sat_calloc(1, sizeof(Id)); - data->schemadata = sat_calloc(1, sizeof(Id)); + data->schemata = solv_calloc(1, sizeof(Id)); + data->schemadata = solv_calloc(1, sizeof(Id)); data->nschemata = 1; data->schemadatalen = 1; repopagestore_init(&data->store); @@ -61,35 +61,35 @@ repodata_freedata(Repodata *data) { int i; - sat_free(data->keys); + solv_free(data->keys); - sat_free(data->schemata); - sat_free(data->schemadata); - sat_free(data->schematahash); + solv_free(data->schemata); + solv_free(data->schemadata); + solv_free(data->schematahash); stringpool_free(&data->spool); dirpool_free(&data->dirpool); - sat_free(data->mainschemaoffsets); - sat_free(data->incoredata); - sat_free(data->incoreoffset); - sat_free(data->verticaloffset); + solv_free(data->mainschemaoffsets); + solv_free(data->incoredata); + solv_free(data->incoreoffset); + solv_free(data->verticaloffset); repopagestore_free(&data->store); - sat_free(data->vincore); + solv_free(data->vincore); if (data->attrs) for (i = 0; i < data->end - data->start; i++) - sat_free(data->attrs[i]); - sat_free(data->attrs); + solv_free(data->attrs[i]); + solv_free(data->attrs); if (data->xattrs) for (i = 0; i < data->nxattrs; i++) - sat_free(data->xattrs[i]); - sat_free(data->xattrs); + solv_free(data->xattrs[i]); + solv_free(data->xattrs); - sat_free(data->attrdata); - sat_free(data->attriddata); + solv_free(data->attrdata); + solv_free(data->attriddata); } Repodata * @@ -98,7 +98,7 @@ repodata_create(Repo *repo, int localpool) Repodata *data; repo->nrepodata++; - repo->repodata = sat_realloc2(repo->repodata, repo->nrepodata, sizeof(*data)); + repo->repodata = solv_realloc2(repo->repodata, repo->nrepodata, sizeof(*data)); data = repo->repodata + repo->nrepodata - 1; repodata_initdata(data, repo, localpool); return data; @@ -150,11 +150,11 @@ repodata_key2id(Repodata *data, Repokey *key, int create) if (!create) return 0; /* allocate new key */ - data->keys = sat_realloc2(data->keys, data->nkeys + 1, sizeof(Repokey)); + data->keys = solv_realloc2(data->keys, data->nkeys + 1, sizeof(Repokey)); data->keys[data->nkeys++] = *key; if (data->verticaloffset) { - data->verticaloffset = sat_realloc2(data->verticaloffset, data->nkeys, sizeof(Id)); + data->verticaloffset = solv_realloc2(data->verticaloffset, data->nkeys, sizeof(Id)); data->verticaloffset[data->nkeys - 1] = 0; } data->keybits[(key->name >> 3) & (sizeof(data->keybits) - 1)] |= 1 << (key->name & 7); @@ -181,7 +181,7 @@ repodata_schema2id(Repodata *data, Id *schema, int create) return 0; /* XXX: allow empty schema? */ if ((schematahash = data->schematahash) == 0) { - data->schematahash = schematahash = sat_calloc(256, sizeof(Id)); + data->schematahash = schematahash = solv_calloc(256, sizeof(Id)); for (i = 1; i < data->nschemata; i++) { for (sp = data->schemadata + data->schemata[i], h = 0; *sp; len++) @@ -189,8 +189,8 @@ repodata_schema2id(Repodata *data, Id *schema, int create) h &= 255; schematahash[h] = i; } - data->schemadata = sat_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK); - data->schemata = sat_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK); + data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK); + data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK); } for (sp = schema, len = 0, h = 0; *sp; len++) @@ -211,8 +211,8 @@ repodata_schema2id(Repodata *data, Id *schema, int create) /* a new one */ if (!create) return 0; - data->schemadata = sat_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK); - data->schemata = sat_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK); + data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK); + data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK); /* add schema */ memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id)); data->schemata[data->nschemata] = data->schemadatalen; @@ -227,10 +227,10 @@ fprintf(stderr, "schema2id: new schema\n"); void repodata_free_schemahash(Repodata *data) { - data->schematahash = sat_free(data->schematahash); + data->schematahash = solv_free(data->schematahash); /* shrink arrays */ - data->schemata = sat_realloc2(data->schemata, data->nschemata, sizeof(Id)); - data->schemadata = sat_realloc2(data->schemadata, data->schemadatalen, sizeof(Id)); + data->schemata = solv_realloc2(data->schemata, data->nschemata, sizeof(Id)); + data->schemadata = solv_realloc2(data->schemadata, data->schemadatalen, sizeof(Id)); } @@ -977,11 +977,11 @@ datamatcher_init(Datamatcher *ma, const char *match, int flags) ma->matchdata = 0; if ((flags & SEARCH_STRINGMASK) == SEARCH_REGEX) { - ma->matchdata = sat_calloc(1, sizeof(regex_t)); + ma->matchdata = solv_calloc(1, sizeof(regex_t)); ma->error = regcomp((regex_t *)ma->matchdata, match, REG_EXTENDED | REG_NOSUB | REG_NEWLINE | ((flags & SEARCH_NOCASE) ? REG_ICASE : 0)); if (ma->error) { - sat_free(ma->matchdata); + solv_free(ma->matchdata); ma->flags = (flags & ~SEARCH_STRINGMASK) | SEARCH_ERROR; } } @@ -994,7 +994,7 @@ datamatcher_free(Datamatcher *ma) if ((ma->flags & SEARCH_STRINGMASK) == SEARCH_REGEX && ma->matchdata) { regfree(ma->matchdata); - ma->matchdata = sat_free(ma->matchdata); + ma->matchdata = solv_free(ma->matchdata); } } @@ -1746,10 +1746,10 @@ repodata_extend(Repodata *data, Id p) int new = p - data->end + 1; if (data->attrs) { - data->attrs = sat_extend(data->attrs, old, new, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_extend(data->attrs, old, new, sizeof(Id *), REPODATA_BLOCK); memset(data->attrs + old, 0, new * sizeof(Id *)); } - data->incoreoffset = sat_extend(data->incoreoffset, old, new, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend(data->incoreoffset, old, new, sizeof(Id), REPODATA_BLOCK); memset(data->incoreoffset + old, 0, new * sizeof(Id)); data->end = p + 1; } @@ -1759,11 +1759,11 @@ repodata_extend(Repodata *data, Id p) int new = data->start - p; if (data->attrs) { - data->attrs = sat_extend_resize(data->attrs, old + new, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_extend_resize(data->attrs, old + new, sizeof(Id *), REPODATA_BLOCK); memmove(data->attrs + new, data->attrs, old * sizeof(Id *)); memset(data->attrs, 0, new * sizeof(Id *)); } - data->incoreoffset = sat_extend_resize(data->incoreoffset, old + new, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend_resize(data->incoreoffset, old + new, sizeof(Id), REPODATA_BLOCK); memmove(data->incoreoffset + new, data->incoreoffset, old * sizeof(Id)); memset(data->incoreoffset, 0, new * sizeof(Id)); data->start = p; @@ -1783,21 +1783,21 @@ repodata_shrink(Repodata *data, int end) if (data->attrs) { for (i = 0; i < data->end - data->start; i++) - sat_free(data->attrs[i]); - data->attrs = sat_free(data->attrs); + solv_free(data->attrs[i]); + data->attrs = solv_free(data->attrs); } - data->incoreoffset = sat_free(data->incoreoffset); + data->incoreoffset = solv_free(data->incoreoffset); data->start = data->end = 0; return; } if (data->attrs) { for (i = end; i < data->end; i++) - sat_free(data->attrs[i - data->start]); - data->attrs = sat_extend_resize(data->attrs, end - data->start, sizeof(Id *), REPODATA_BLOCK); + solv_free(data->attrs[i - data->start]); + data->attrs = solv_extend_resize(data->attrs, end - data->start, sizeof(Id *), REPODATA_BLOCK); } if (data->incoreoffset) - data->incoreoffset = sat_extend_resize(data->incoreoffset, end - data->start, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend_resize(data->incoreoffset, end - data->start, sizeof(Id), REPODATA_BLOCK); data->end = end; } @@ -1809,7 +1809,7 @@ repodata_extend_block(Repodata *data, Id start, Id num) return; if (!data->incoreoffset) { - data->incoreoffset = sat_calloc_block(num, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_calloc_block(num, sizeof(Id), REPODATA_BLOCK); data->start = start; data->end = start + num; return; @@ -1832,10 +1832,10 @@ repodata_new_handle(Repodata *data) { if (!data->nxattrs) { - data->xattrs = sat_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); data->nxattrs = 2; /* -1: SOLVID_META */ } - data->xattrs = sat_extend(data->xattrs, data->nxattrs, 1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_extend(data->xattrs, data->nxattrs, 1, sizeof(Id *), REPODATA_BLOCK); data->xattrs[data->nxattrs] = 0; return -(data->nxattrs++); } @@ -1847,7 +1847,7 @@ repodata_get_attrp(Repodata *data, Id handle) { if (handle == SOLVID_META && !data->xattrs) { - data->xattrs = sat_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); data->nxattrs = 2; } return data->xattrs - handle; @@ -1855,7 +1855,7 @@ repodata_get_attrp(Repodata *data, Id handle) if (handle < data->start || handle >= data->end) repodata_extend(data, handle); if (!data->attrs) - data->attrs = sat_calloc_block(data->end - data->start, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_calloc_block(data->end - data->start, sizeof(Id *), REPODATA_BLOCK); return data->attrs + (handle - data->start); } @@ -1887,7 +1887,7 @@ repodata_insert_keyid(Repodata *data, Id handle, Id keyid, Id val, int overwrite } i = pp - ap; } - ap = sat_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK); + ap = solv_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK); *app = ap; pp = ap + i; *pp++ = keyid; @@ -1987,7 +1987,7 @@ repodata_set_str(Repodata *data, Id solvid, Id keyname, const char *str) key.type = REPOKEY_TYPE_STR; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); repodata_set(data, solvid, &key, data->attrdatalen); data->attrdatalen += l; @@ -2003,7 +2003,7 @@ repodata_set_binary(Repodata *data, Id solvid, Id keyname, void *buf, int len) key.type = REPOKEY_TYPE_BINARY; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, len + 5, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, len + 5, 1, REPODATA_ATTRDATA_BLOCK); dp = data->attrdata + data->attrdatalen; if (len >= (1 << 14)) { @@ -2034,7 +2034,7 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys if (handle == data->lasthandle && data->keys[data->lastkey].name == keyname && data->keys[data->lastkey].type == keytype && data->attriddatalen == data->lastdatalen) { /* great! just append the new data */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); data->attriddatalen--; /* overwrite terminating 0 */ data->lastdatalen += entrysize; return; @@ -2057,7 +2057,7 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys key.type = keytype; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); keyid = repodata_key2id(data, &key, 1); repodata_insert_keyid(data, handle, keyid, data->attriddatalen, 1); data->lasthandle = handle; @@ -2071,13 +2071,13 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys if (ida + 1 == data->attriddata + data->attriddatalen) { /* this was the last entry, just append it */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); data->attriddatalen--; /* overwrite terminating 0 */ } else { /* too bad. move to back. */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, oldsize + entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, oldsize + entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); memcpy(data->attriddata + data->attriddatalen, data->attriddata + pp[1], oldsize * sizeof(Id)); pp[1] = data->attriddatalen; data->attriddatalen += oldsize; @@ -2094,13 +2094,13 @@ repodata_set_bin_checksum(Repodata *data, Id solvid, Id keyname, Id type, Repokey key; int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return; key.name = keyname; key.type = type; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); repodata_set(data, solvid, &key, data->attrdatalen); data->attrdatalen += l; @@ -2113,9 +2113,9 @@ repodata_set_checksum(Repodata *data, Id solvid, Id keyname, Id type, unsigned char buf[64]; int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return; - if (l > sizeof(buf) || sat_hex2bin(&str, buf, l) != l) + if (l > sizeof(buf) || solv_hex2bin(&str, buf, l) != l) return; repodata_set_bin_checksum(data, solvid, keyname, type, buf); } @@ -2125,7 +2125,7 @@ repodata_chk2str(Repodata *data, Id type, const unsigned char *buf) { int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return ""; return pool_bin2hex(data->repo->pool, buf, l); } @@ -2222,7 +2222,7 @@ repodata_set_idarray(Repodata *data, Id solvid, Id keyname, Queue *q) key.size = 0; key.storage = KEY_STORAGE_INCORE; repodata_set(data, solvid, &key, data->attriddatalen); - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, q->count + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, q->count + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); for (i = 0; i < q->count; i++) data->attriddata[data->attriddatalen++] = q->elements[i]; data->attriddata[data->attriddatalen++] = 0; @@ -2250,7 +2250,7 @@ repodata_add_dirstr(Repodata *data, Id solvid, Id keyname, Id dir, const char *s assert(dir); l = strlen(str) + 1; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); stroff = data->attrdatalen; data->attrdatalen += l; @@ -2381,7 +2381,7 @@ data_addid(struct extdata *xd, Id x) { unsigned char *dp; - xd->buf = sat_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); dp = xd->buf + xd->len; if (x >= (1 << 14)) @@ -2409,7 +2409,7 @@ data_addideof(struct extdata *xd, Id x, int eof) static void data_addblob(struct extdata *xd, unsigned char *blob, int len) { - xd->buf = sat_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); memcpy(xd->buf + xd->len, blob, len); xd->len += len; } @@ -2503,7 +2503,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, schemaid = repodata_schema2id(data, schema, 1); else if (schemaid != repodata_schema2id(data, schema, 0)) { - pool_debug(data->repo->pool, SAT_FATAL, "fixarray substructs with different schemas\n"); + pool_debug(data->repo->pool, SOLV_FATAL, "fixarray substructs with different schemas\n"); exit(1); } } @@ -2548,7 +2548,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, break; } default: - pool_debug(data->repo->pool, SAT_FATAL, "don't know how to handle type %d\n", key->type); + pool_debug(data->repo->pool, SOLV_FATAL, "don't know how to handle type %d\n", key->type); exit(1); } if (key->storage == KEY_STORAGE_VERTICAL_OFFSET) @@ -2586,8 +2586,8 @@ repodata_internalize(Repodata *data) solvkey.storage = KEY_STORAGE_INCORE; solvkeyid = repodata_key2id(data, &solvkey, data->end != data->start ? 1 : 0); - schema = sat_malloc2(data->nkeys, sizeof(Id)); - seen = sat_malloc2(data->nkeys, sizeof(Id)); + schema = solv_malloc2(data->nkeys, sizeof(Id)); + seen = solv_malloc2(data->nkeys, sizeof(Id)); /* Merge the data already existing (in data->schemata, ->incoredata and friends) with the new attributes in data->attrs[]. */ @@ -2596,7 +2596,7 @@ repodata_internalize(Repodata *data) data_addid(&newincore, 0); /* start data at offset 1 */ data->mainschema = 0; - data->mainschemaoffsets = sat_free(data->mainschemaoffsets); + data->mainschemaoffsets = solv_free(data->mainschemaoffsets); /* join entry data */ /* we start with the meta data, entry -1 */ @@ -2623,7 +2623,7 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); { if (seen[*keyp]) { - pool_debug(data->repo->pool, SAT_FATAL, "Inconsistent old data (key occured twice).\n"); + pool_debug(data->repo->pool, SOLV_FATAL, "Inconsistent old data (key occured twice).\n"); exit(1); } seen[*keyp] = -1; @@ -2685,7 +2685,7 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); if (entry == -1) { data->mainschema = schemaid; - data->mainschemaoffsets = sat_calloc(sp - schema, sizeof(Id)); + data->mainschemaoffsets = solv_calloc(sp - schema, sizeof(Id)); } keypstart = data->schemadata + data->schemata[schemaid]; for (keyp = keypstart; *keyp; keyp++) @@ -2734,34 +2734,34 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); dp = ndp; } if (entry >= 0 && data->attrs && data->attrs[entry]) - data->attrs[entry] = sat_free(data->attrs[entry]); + data->attrs[entry] = solv_free(data->attrs[entry]); } /* free all xattrs */ for (entry = 0; entry < data->nxattrs; entry++) if (data->xattrs[entry]) - sat_free(data->xattrs[entry]); - data->xattrs = sat_free(data->xattrs); + solv_free(data->xattrs[entry]); + data->xattrs = solv_free(data->xattrs); data->nxattrs = 0; data->lasthandle = 0; data->lastkey = 0; data->lastdatalen = 0; - sat_free(schema); - sat_free(seen); + solv_free(schema); + solv_free(seen); repodata_free_schemahash(data); - sat_free(data->incoredata); + solv_free(data->incoredata); data->incoredata = newincore.buf; data->incoredatalen = newincore.len; data->incoredatafree = 0; - sat_free(data->vincore); + solv_free(data->vincore); data->vincore = newvincore.buf; data->vincorelen = newvincore.len; - data->attrs = sat_free(data->attrs); - data->attrdata = sat_free(data->attrdata); - data->attriddata = sat_free(data->attriddata); + data->attrs = solv_free(data->attrs); + data->attrdata = solv_free(data->attrdata); + data->attriddata = solv_free(data->attriddata); data->attrdatalen = 0; data->attriddatalen = 0; } @@ -2796,7 +2796,7 @@ repodata_load_stub(Repodata *data) /* restore tmp space */ for (i = 0; i < POOL_TMPSPACEBUF; i++) - sat_free(pool->tmpspace.buf[i]); + solv_free(pool->tmpspace.buf[i]); pool->tmpspace = oldtmpspace; data->state = r ? REPODATA_AVAILABLE : REPODATA_ERROR; @@ -2828,7 +2828,7 @@ repodata_create_stubs(Repodata *data) dataiterator_free(&di); if (!cnt) return; - stubdataids = sat_calloc(cnt, sizeof(*stubdataids)); + stubdataids = solv_calloc(cnt, sizeof(*stubdataids)); for (i = 0; i < cnt; i++) { sdata = repo_add_repodata(repo, 0); @@ -2900,7 +2900,7 @@ repodata_create_stubs(Repodata *data) dataiterator_free(&di); for (i = 0; i < cnt; i++) repodata_internalize(repo->repodata + stubdataids[i]); - sat_free(stubdataids); + solv_free(stubdataids); } /* diff --git a/src/repopage.c b/src/repopage.c index 0dbdfdb..ad633a3 100644 --- a/src/repopage.c +++ b/src/repopage.c @@ -559,9 +559,9 @@ void repopagestore_init(Repopagestore *store) void repopagestore_free(Repopagestore *store) { - sat_free(store->blob_store); - sat_free(store->pages); - sat_free(store->mapped); + solv_free(store->blob_store); + solv_free(store->pages); + solv_free(store->mapped); if (store->pagefd != -1) close(store->pagefd); } @@ -597,9 +597,9 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne store->ncanmap = pend - pstart + 1; if (store->ncanmap < 4) store->ncanmap = 4; - store->mapped = sat_realloc2(store->mapped, store->ncanmap, sizeof(store->mapped[0])); + store->mapped = solv_realloc2(store->mapped, store->ncanmap, sizeof(store->mapped[0])); memset(store->mapped + oldcan, 0, (store->ncanmap - oldcan) * sizeof (store->mapped[0])); - store->blob_store = sat_realloc2(store->blob_store, store->ncanmap, REPOPAGE_BLOBSIZE); + store->blob_store = solv_realloc2(store->blob_store, store->ncanmap, REPOPAGE_BLOBSIZE); #ifdef DEBUG_PAGING fprintf(stderr, "PAGE: can map %d pages\n", store->ncanmap); #endif @@ -789,11 +789,11 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p npages = (blobsz + REPOPAGE_BLOBSIZE - 1) / REPOPAGE_BLOBSIZE; store->num_pages = npages; - store->pages = sat_malloc2(npages, sizeof(store->pages[0])); + store->pages = solv_malloc2(npages, sizeof(store->pages[0])); /* If we can't seek on our input we have to slurp in everything. */ if (!can_seek) - store->blob_store = sat_malloc2(npages, REPOPAGE_BLOBSIZE); + store->blob_store = solv_malloc2(npages, REPOPAGE_BLOBSIZE); for (i = 0; i < npages; i++) { unsigned int in_len = read_u32(fp); diff --git a/src/rules.c b/src/rules.c index cb75b70..a423600 100644 --- a/src/rules.c +++ b/src/rules.c @@ -145,7 +145,7 @@ solver_unifyrules(Solver *solv) return; /* sort rules first */ - sat_sort(solv->rules + 1, solv->nrules - 1, sizeof(Rule), unifyrules_sortcmp, solv->pool); + solv_sort(solv->rules + 1, solv->nrules - 1, sizeof(Rule), unifyrules_sortcmp, solv->pool); /* prune rules * i = unpruned @@ -162,16 +162,16 @@ solver_unifyrules(Solver *solv) } /* reduced count from nrules to j rules */ - POOL_DEBUG(SAT_DEBUG_STATS, "pruned rules from %d to %d\n", solv->nrules, j); + POOL_DEBUG(SOLV_DEBUG_STATS, "pruned rules from %d to %d\n", solv->nrules, j); /* adapt rule buffer */ solv->nrules = j; - solv->rules = sat_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); /* * debug: log rule statistics */ - IF_POOLDEBUG (SAT_DEBUG_STATS) + IF_POOLDEBUG (SOLV_DEBUG_STATS) { int binr = 0; int lits = 0; @@ -190,8 +190,8 @@ solver_unifyrules(Solver *solv) lits++; } } - POOL_DEBUG(SAT_DEBUG_STATS, " binary: %d\n", binr); - POOL_DEBUG(SAT_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits); + POOL_DEBUG(SOLV_DEBUG_STATS, " binary: %d\n", binr); + POOL_DEBUG(SOLV_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits); } } @@ -337,7 +337,7 @@ solver_addrule(Solver *solv, Id p, Id d) */ /* extend rule buffer */ - solv->rules = sat_extend(solv->rules, solv->nrules, 1, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend(solv->rules, solv->nrules, 1, sizeof(Rule), RULES_BLOCK); r = solv->rules + solv->nrules++; /* point to rule space */ /* @@ -368,10 +368,10 @@ solver_addrule(Solver *solv, Id p, Id d) r->n1 = 0; r->n2 = 0; - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " Add rule: "); - solver_printrule(solv, SAT_DEBUG_RULE_CREATION, r); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, " Add rule: "); + solver_printrule(solv, SOLV_DEBUG_RULE_CREATION, r); } return r; @@ -512,7 +512,7 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) && s->arch != ARCH_NOSRC && !pool_installable(pool, s)) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables)); addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOT_INSTALLABLE, 0); } @@ -563,7 +563,7 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) /* didn't find an installed provider: previously broken dependency */ if (!p) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "ignoring broken requires %s of installed package %s\n", pool_dep2str(pool, req), pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "ignoring broken requires %s of installed package %s\n", pool_dep2str(pool, req), pool_solvable2str(pool, s)); continue; } } @@ -571,16 +571,16 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) if (!*dp) { /* nothing provides req! */ - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable (%s)\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables), pool_dep2str(pool, req)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable (%s)\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables), pool_dep2str(pool, req)); addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP, req); continue; } - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION," %s requires %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION," %s requires %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); for (i = 0; dp[i]; i++) - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " provided by %s\n", pool_solvid2str(pool, dp[i])); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, " provided by %s\n", pool_solvid2str(pool, dp[i])); } /* add 'requires' dependency */ @@ -948,7 +948,7 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all) (solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, s - pool->solvables - solv->installed->start)))) { if (!solv->multiversionupdaters) - solv->multiversionupdaters = sat_calloc(solv->installed->end - solv->installed->start, sizeof(Id)); + solv->multiversionupdaters = solv_calloc(solv->installed->end - solv->installed->start, sizeof(Id)); solv->multiversionupdaters[s - pool->solvables - solv->installed->start] = d; } if (j == 0 && p == -SYSTEMSOLVABLE && solv->dupmap_all) @@ -993,10 +993,10 @@ reenableupdaterule(Solver *solv, Id p) if (r->d >= 0) return; solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } return; } @@ -1004,10 +1004,10 @@ reenableupdaterule(Solver *solv, Id p) if (r->p && r->d < 0) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1134,10 +1134,10 @@ reenableinfarchrule(Solver *solv, Id name) if (r->p < 0 && r->d < 0 && pool->solvables[-r->p].name == name) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1300,10 +1300,10 @@ reenableduprule(Solver *solv, Id name) if (r->p < 0 && r->d < 0 && pool->solvables[-r->p].name == name) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1796,7 +1796,7 @@ solver_allruleinfos(Solver *solv, Id rid, Queue *rq) /* now sort & unify em */ if (!rq->count) return 0; - sat_sort(rq->elements, rq->count / 4, 4 * sizeof(Id), solver_allruleinfos_cmp, 0); + solv_sort(rq->elements, rq->count / 4, 4 * sizeof(Id), solver_allruleinfos_cmp, 0); /* throw out identical entries */ for (i = j = 0; i < rq->count; i += 4) { @@ -1979,7 +1979,7 @@ solver_addchoicerules(Solver *solv) solv->choicerules_end = solv->nrules; return; } - solv->choicerules_ref = sat_calloc(solv->rpmrules_end, sizeof(Id)); + solv->choicerules_ref = solv_calloc(solv->rpmrules_end, sizeof(Id)); queue_init(&q); queue_init(&qi); map_init(&m, pool->nsolvables); @@ -1996,7 +1996,7 @@ solver_addchoicerules(Solver *solv) r = solv->rules + rid; if (r->p >= 0 || ((r->d == 0 || r->d == -1) && r->w2 < 0)) continue; /* only look at requires rules */ - // solver_printrule(solv, SAT_DEBUG_RESULT, r); + // solver_printrule(solv, SOLV_DEBUG_RESULT, r); queue_empty(&q); queue_empty(&qi); havechoice = 0; @@ -2103,7 +2103,7 @@ solver_addchoicerules(Solver *solv) { #if 0 printf("skipping choice "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + rid); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid); #endif continue; } @@ -2113,9 +2113,9 @@ solver_addchoicerules(Solver *solv) solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid; #if 0 printf("OLD "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + rid); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid); printf("WEAK CHOICE "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + solv->nrules - 1); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + solv->nrules - 1); #endif } queue_free(&q); diff --git a/src/satversion.c b/src/satversion.c deleted file mode 100644 index 4d28125..0000000 --- a/src/satversion.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2009, Novell Inc. - * - * This program is licensed under the BSD license, read LICENSE.BSD - * for further information - */ - -#include "satversion.h" - -const char sat_version[] = LIBSOLV_VERSION_STRING; -int sat_version_major = LIBSOLV_VERSION_MAJOR; -int sat_version_minor = LIBSOLV_VERSION_MINOR; -int sat_version_patch = LIBSOLV_VERSION_PATCH; diff --git a/src/sha1.c b/src/sha1.c index a8361d9..668331f 100644 --- a/src/sha1.c +++ b/src/sha1.c @@ -159,7 +159,7 @@ static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) /* SHA1Init - Initialize new context */ -void sat_SHA1_Init(SHA1_CTX* context) +void solv_SHA1_Init(SHA1_CTX* context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; @@ -172,7 +172,7 @@ void sat_SHA1_Init(SHA1_CTX* context) /* Run your data through this. */ -void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) +void solv_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) { size_t i, j; @@ -201,7 +201,7 @@ void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) /* Add padding and return the message digest. */ -void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) +void solv_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) { uint32_t i; uint8_t finalcount[8]; @@ -210,11 +210,11 @@ void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } - sat_SHA1_Update(context, (uint8_t *)"\200", 1); + solv_SHA1_Update(context, (uint8_t *)"\200", 1); while ((context->count[0] & 504) != 448) { - sat_SHA1_Update(context, (uint8_t *)"\0", 1); + solv_SHA1_Update(context, (uint8_t *)"\0", 1); } - sat_SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */ + solv_SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */ for (i = 0; i < SHA1_DIGEST_SIZE; i++) { digest[i] = (uint8_t) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); diff --git a/src/sha1.h b/src/sha1.h index a708ef1..0423164 100644 --- a/src/sha1.h +++ b/src/sha1.h @@ -11,6 +11,6 @@ typedef struct { #define SHA1_DIGEST_SIZE 20 -void sat_SHA1_Init(SHA1_CTX* context); -void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); -void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); +void solv_SHA1_Init(SHA1_CTX* context); +void solv_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); +void solv_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); diff --git a/src/sha2.c b/src/sha2.c index a9cf41b..06986f8 100644 --- a/src/sha2.c +++ b/src/sha2.c @@ -330,7 +330,7 @@ static const char *sha2_hex_digits = "0123456789abcdef"; /*** SHA-256: *********************************************************/ -void sat_SHA256_Init(SHA256_CTX* context) { +void solv_SHA256_Init(SHA256_CTX* context) { if (context == (SHA256_CTX*)0) { return; } @@ -514,7 +514,7 @@ static void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void sat_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { +void solv_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -562,7 +562,7 @@ void sat_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { usedspace = freespace = 0; } -void sat_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { +void solv_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; unsigned int usedspace; @@ -625,7 +625,7 @@ void sat_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { usedspace = 0; } -char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { +char *solv_SHA256_End(SHA256_CTX* context, char buffer[]) { sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest; int i; @@ -633,7 +633,7 @@ char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { /* assert(context != (SHA256_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA256_Final(digest, context); + solv_SHA256_Final(digest, context); for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -648,17 +648,17 @@ char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { +char* solv_SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { SHA256_CTX context; - sat_SHA256_Init(&context); - sat_SHA256_Update(&context, data, len); - return sat_SHA256_End(&context, digest); + solv_SHA256_Init(&context); + solv_SHA256_Update(&context, data, len); + return solv_SHA256_End(&context, digest); } /*** SHA-512: *********************************************************/ -void sat_SHA512_Init(SHA512_CTX* context) { +void solv_SHA512_Init(SHA512_CTX* context) { if (context == (SHA512_CTX*)0) { return; } @@ -836,7 +836,7 @@ static void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void sat_SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { +void solv_SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -925,7 +925,7 @@ static void SHA512_Last(SHA512_CTX* context) { SHA512_Transform(context, (sha2_word64*)context->buffer); } -void sat_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { +void solv_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -954,7 +954,7 @@ void sat_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { MEMSET_BZERO(context, sizeof(context)); } -char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { +char *solv_SHA512_End(SHA512_CTX* context, char buffer[]) { sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; int i; @@ -962,7 +962,7 @@ char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { /* assert(context != (SHA512_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA512_Final(digest, context); + solv_SHA512_Final(digest, context); for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -977,17 +977,17 @@ char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { +char* solv_SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { SHA512_CTX context; - sat_SHA512_Init(&context); - sat_SHA512_Update(&context, data, len); - return sat_SHA512_End(&context, digest); + solv_SHA512_Init(&context); + solv_SHA512_Update(&context, data, len); + return solv_SHA512_End(&context, digest); } /*** SHA-384: *********************************************************/ -void sat_SHA384_Init(SHA384_CTX* context) { +void solv_SHA384_Init(SHA384_CTX* context) { if (context == (SHA384_CTX*)0) { return; } @@ -996,11 +996,11 @@ void sat_SHA384_Init(SHA384_CTX* context) { context->bitcount[0] = context->bitcount[1] = 0; } -void sat_SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - sat_SHA512_Update((SHA512_CTX*)context, data, len); +void solv_SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { + solv_SHA512_Update((SHA512_CTX*)context, data, len); } -void sat_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { +void solv_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -1029,7 +1029,7 @@ void sat_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { MEMSET_BZERO(context, sizeof(context)); } -char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { +char *solv_SHA384_End(SHA384_CTX* context, char buffer[]) { sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; int i; @@ -1037,7 +1037,7 @@ char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { /* assert(context != (SHA384_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA384_Final(digest, context); + solv_SHA384_Final(digest, context); for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -1052,10 +1052,10 @@ char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { +char* solv_SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { SHA384_CTX context; - sat_SHA384_Init(&context); - sat_SHA384_Update(&context, data, len); - return sat_SHA384_End(&context, digest); + solv_SHA384_Init(&context); + solv_SHA384_Update(&context, data, len); + return solv_SHA384_End(&context, digest); } diff --git a/src/sha2.h b/src/sha2.h index 2c139ae..c39014a 100644 --- a/src/sha2.h +++ b/src/sha2.h @@ -67,20 +67,20 @@ typedef SHA512_CTX SHA384_CTX; /*** SHA-256/384/512 Function Prototypes ******************************/ -void sat_SHA256_Init(SHA256_CTX *); -void sat_SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); -void sat_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* sat_SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); -char* sat_SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void solv_SHA256_Init(SHA256_CTX *); +void solv_SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); +void solv_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* solv_SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* solv_SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); -void sat_SHA384_Init(SHA384_CTX*); -void sat_SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); -void sat_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); -char* sat_SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); -char* sat_SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void solv_SHA384_Init(SHA384_CTX*); +void solv_SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); +void solv_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* solv_SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* solv_SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); -void sat_SHA512_Init(SHA512_CTX*); -void sat_SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); -void sat_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -char* sat_SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); -char* sat_SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void solv_SHA512_Init(SHA512_CTX*); +void solv_SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); +void solv_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* solv_SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* solv_SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); diff --git a/src/solvable.c b/src/solvable.c index ef9bd4c..2747acc 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -121,7 +121,7 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) cols = pool->nlanguages + 1; if (!pool->languagecache) { - pool->languagecache = sat_calloc(cols * ID_NUM_INTERNAL, sizeof(Id)); + pool->languagecache = solv_calloc(cols * ID_NUM_INTERNAL, sizeof(Id)); pool->languagecacheother = 0; } if (keyname >= ID_NUM_INTERNAL) @@ -132,7 +132,7 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) break; if (i >= pool->languagecacheother) { - pool->languagecache = sat_realloc2(pool->languagecache, pool->languagecacheother + 1, cols * sizeof(Id)); + pool->languagecache = solv_realloc2(pool->languagecache, pool->languagecacheother + 1, cols * sizeof(Id)); row = pool->languagecache + cols * (ID_NUM_INTERNAL + pool->languagecacheother++); *row = keyname; } @@ -209,7 +209,7 @@ const char * solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep) { const unsigned char *chk = solvable_lookup_bin_checksum(s, keyname, typep); - return chk ? pool_bin2hex(s->repo->pool, chk, sat_chksum_len(*typep)) : 0; + return chk ? pool_bin2hex(s->repo->pool, chk, solv_chksum_len(*typep)) : 0; } static inline const char * diff --git a/src/solver.c b/src/solver.c index eb55f4a..704b380 100644 --- a/src/solver.c +++ b/src/solver.c @@ -144,13 +144,13 @@ makeruledecisions(Solver *solv) queue_push(&solv->decisionq, v); queue_push(&solv->decisionq_why, r - solv->rules); solv->decisionmap[vv] = v > 0 ? 1 : -1; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { Solvable *s = solv->pool->solvables + vv; if (v < 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "conflicting %s (assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "conflicting %s (assertion)\n", pool_solvable2str(solv->pool, s)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "installing %s (assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "installing %s (assertion)\n", pool_solvable2str(solv->pool, s)); } continue; } @@ -205,7 +205,7 @@ makeruledecisions(Solver *solv) } else queue_push(&solv->problems, 0); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflict with system solvable, disabling rule #%d\n", ri); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflict with system solvable, disabling rule #%d\n", ri); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); else @@ -235,7 +235,7 @@ makeruledecisions(Solver *solv) else queue_push(&solv->problems, 0); assert(v > 0 || v == -SYSTEMSOLVABLE); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflict with rpm rule, disabling rule #%d\n", ri); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflict with rpm rule, disabling rule #%d\n", ri); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); else @@ -261,7 +261,7 @@ makeruledecisions(Solver *solv) else queue_push(&solv->problems, 0); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflicting update/job assertions over literal %d\n", vv); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflicting update/job assertions over literal %d\n", vv); /* * push all of our rules (can only be feature or job rules) @@ -279,9 +279,9 @@ makeruledecisions(Solver *solv) if (MAPTST(&solv->weakrulemap, i)) /* weak: silently ignore */ continue; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, " - disabling rule #%d\n", i); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, " - disabling rule #%d\n", i); - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, solv->rules + i); + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, solv->rules + i); v = i; /* is is a job rule ? */ @@ -329,13 +329,13 @@ makeruledecisions(Solver *solv) queue_push(&solv->decisionq, v); queue_push(&solv->decisionq_why, r - solv->rules); solv->decisionmap[vv] = v > 0 ? 1 : -1; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { Solvable *s = solv->pool->solvables + vv; if (v < 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "conflicting %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "conflicting %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "installing %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "installing %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); } continue; } @@ -347,8 +347,8 @@ makeruledecisions(Solver *solv) if (v < 0 && solv->decisionmap[vv] < 0) continue; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "assertion conflict, but I am weak, disabling "); - solver_printrule(solv, SAT_DEBUG_UNSOLVABLE, r); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "assertion conflict, but I am weak, disabling "); + solver_printrule(solv, SOLV_DEBUG_UNSOLVABLE, r); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); @@ -376,7 +376,7 @@ enabledisablelearntrules(Solver *solv) Id why, *whyp; int i; - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "enabledisablelearntrules called\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "enabledisablelearntrules called\n"); for (i = solv->learntrules, r = solv->rules + i; i < solv->nrules; i++, r++) { whyp = solv->learnt_pool.elements + solv->learnt_why.elements[i - solv->learntrules]; @@ -389,19 +389,19 @@ enabledisablelearntrules(Solver *solv) /* why != 0: we found a disabled rule, disable the learnt rule */ if (why && r->d >= 0) { - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "disabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "disabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } solver_disablerule(solv, r); } else if (!why && r->d < 0) { - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } solver_enablerule(solv, r); } @@ -426,9 +426,9 @@ makewatches(Solver *solv) int i; int nsolvables = solv->pool->nsolvables; - sat_free(solv->watches); + solv_free(solv->watches); /* lower half for removals, upper half for installs */ - solv->watches = sat_calloc(2 * nsolvables, sizeof(Id)); + solv->watches = solv_calloc(2 * nsolvables, sizeof(Id)); #if 1 /* do it reverse so rpm rules get triggered first (XXX: obsolete?) */ for (i = 1, r = solv->rules + solv->nrules - 1; i < solv->nrules; i++, r--) @@ -511,7 +511,7 @@ propagate(Solver *solv, int level) Id *watches = solv->watches + pool->nsolvables; /* place ptr in middle */ - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate -----\n"); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "----- propagate -----\n"); /* foreach non-propagated decision */ while (solv->propagate_index < solv->decisionq.count) @@ -522,10 +522,10 @@ propagate(Solver *solv, int level) */ pkg = -solv->decisionq.elements[solv->propagate_index++]; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagate for decision %d level %d\n", -pkg, level); - solver_printruleelement(solv, SAT_DEBUG_PROPAGATE, 0, -pkg); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "propagate for decision %d level %d\n", -pkg, level); + solver_printruleelement(solv, SOLV_DEBUG_PROPAGATE, 0, -pkg); } /* foreach rule where 'pkg' is now FALSE */ @@ -542,10 +542,10 @@ propagate(Solver *solv, int level) continue; } - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE," watch triggered "); - solver_printrule(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE," watch triggered "); + solver_printrule(solv, SOLV_DEBUG_PROPAGATE, r); } /* 'pkg' was just decided (was set to FALSE) @@ -611,12 +611,12 @@ propagate(Solver *solv, int level) * if we found some p that is UNDEF or TRUE, move * watch to it */ - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { if (p > 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, p)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p)); } *rp = *next_rp; @@ -646,10 +646,10 @@ propagate(Solver *solv, int level) if (DECISIONMAP_FALSE(other_watch)) /* check if literal is FALSE */ return r; /* eek, a conflict! */ - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " unit "); - solver_printrule(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " unit "); + solver_printrule(solv, SOLV_DEBUG_PROPAGATE, r); } if (other_watch > 0) @@ -660,19 +660,19 @@ propagate(Solver *solv, int level) queue_push(&solv->decisionq, other_watch); queue_push(&solv->decisionq_why, r - solv->rules); - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { if (other_watch > 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to install %s\n", pool_solvid2str(pool, other_watch)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> decided to install %s\n", pool_solvid2str(pool, other_watch)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to conflict %s\n", pool_solvid2str(pool, -other_watch)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> decided to conflict %s\n", pool_solvid2str(pool, -other_watch)); } } /* foreach rule involving 'pkg' */ } /* while we have non-decided decisions */ - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate end-----\n"); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "----- propagate end-----\n"); return 0; /* all is well */ } @@ -703,13 +703,13 @@ analyze(Solver *solv, int level, Rule *c, int *pr, int *dr, int *whyp) queue_init_buffer(&r, r_buf, sizeof(r_buf)/sizeof(*r_buf)); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level); map_init(&seen, pool->nsolvables); idx = solv->decisionq.count; for (;;) { - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) - solver_printruleclass(solv, SAT_DEBUG_ANALYZE, c); + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) + solver_printruleclass(solv, SOLV_DEBUG_ANALYZE, c); queue_push(&solv->learnt_pool, c - solv->rules); d = c->d < 0 ? -c->d - 1 : c->d; dp = d ? pool->whatprovidesdata + d : 0; @@ -766,7 +766,7 @@ l1retry: *pr = -v; /* so that v doesn't get lost */ if (!l1num) break; - POOL_DEBUG(SAT_DEBUG_ANALYZE, "got %d involved level 1 decisions\n", l1num); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "got %d involved level 1 decisions\n", l1num); /* clear non-l1 bits from seen map */ for (i = 0; i < r.count; i++) { @@ -791,12 +791,12 @@ l1retry: *dr = r.elements[0]; else *dr = pool_queuetowhatprovides(pool, &r); - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) { - POOL_DEBUG(SAT_DEBUG_ANALYZE, "learned rule for level %d (am %d)\n", rlevel, level); - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, *pr); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "learned rule for level %d (am %d)\n", rlevel, level); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, *pr); for (i = 0; i < r.count; i++) - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, r.elements[i]); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, r.elements[i]); } /* push end marker on learnt reasons stack */ queue_push(&solv->learnt_pool, 0); @@ -841,7 +841,7 @@ solver_reset(Solver *solv) /* redo all assertion rule decisions */ makeruledecisions(solv); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "decisions so far: %d\n", solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "decisions so far: %d\n", solv->decisionq.count); } @@ -857,8 +857,8 @@ analyze_unsolvable_rule(Solver *solv, Rule *r, Id *lastweakp, Map *rseen) int i; Id why = r - solv->rules; - IF_POOLDEBUG (SAT_DEBUG_UNSOLVABLE) - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, r); + IF_POOLDEBUG (SOLV_DEBUG_UNSOLVABLE) + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, r); if (solv->learntrules && why >= solv->learntrules) { if (MAPTST(rseen, why - solv->learntrules)) @@ -928,7 +928,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) Id lastweak; int record_proof = 1; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n"); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n"); solv->stats_unsolvable++; oldproblemcount = solv->problems.count; oldlearntpoolcount = solv->learnt_pool.count; @@ -1013,8 +1013,8 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) v = -(solv->ruletojob.elements[lastweak - solv->jobrules] + 1); else v = lastweak; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "disabling "); - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, solv->rules + lastweak); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "disabling "); + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, solv->rules + lastweak); if (lastweak >= solv->choicerules && lastweak < solv->choicerules_end) solver_disablechoicerules(solv, solv->rules + lastweak); solver_disableproblem(solv, v); @@ -1039,7 +1039,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) solver_reset(solv); return 1; } - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "UNSOLVABLE\n"); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "UNSOLVABLE\n"); return 0; } @@ -1064,7 +1064,7 @@ revert(Solver *solv, int level) vv = v > 0 ? v : -v; if (solv->decisionmap[vv] <= level && solv->decisionmap[vv] >= -level) break; - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "reverting decision %d at %d\n", v, solv->decisionmap[vv]); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "reverting decision %d at %d\n", v, solv->decisionmap[vv]); if (v > 0 && solv->recommendations.count && v == solv->recommendations.elements[solv->recommendations.count - 1]) solv->recommendations.count--; solv->decisionmap[vv] = 0; @@ -1153,10 +1153,10 @@ setpropagatelearn(Solver *solv, int level, Id decision, int disablerules, Id rul break; if (level == 1) return analyze_unsolvable(solv, r, disablerules); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "conflict with rule #%d\n", (int)(r - solv->rules)); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "conflict with rule #%d\n", (int)(r - solv->rules)); l = analyze(solv, level, r, &p, &d, &why); /* learnt rule in p and d */ assert(l > 0 && l < level); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "reverting decisions (level %d -> %d)\n", level, l); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "reverting decisions (level %d -> %d)\n", level, l); level = l; revert(solv, level); r = solver_addrule(solv, p, d); @@ -1178,12 +1178,12 @@ setpropagatelearn(Solver *solv, int level, Id decision, int disablerules, Id rul solv->decisionmap[p > 0 ? p : -p] = p > 0 ? level : -level; queue_push(&solv->decisionq, p); queue_push(&solv->decisionq_why, r - solv->rules); - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) { - POOL_DEBUG(SAT_DEBUG_ANALYZE, "decision: "); - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, p); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "new rule: "); - solver_printrule(solv, SAT_DEBUG_ANALYZE, r); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "decision: "); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, p); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "new rule: "); + solver_printrule(solv, SOLV_DEBUG_ANALYZE, r); } } return level; @@ -1233,7 +1233,7 @@ selectandinstall(Solver *solv, int level, Queue *dq, int disablerules, Id ruleid } p = dq->elements[0]; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing %s\n", pool_solvid2str(pool, p)); return setpropagatelearn(solv, level, p, disablerules, ruleid); } @@ -1260,7 +1260,7 @@ Solver * solver_create(Pool *pool) { Solver *solv; - solv = (Solver *)sat_calloc(1, sizeof(Solver)); + solv = (Solver *)solv_calloc(1, sizeof(Solver)); solv->pool = pool; solv->installed = pool->installed; @@ -1284,9 +1284,9 @@ solver_create(Pool *pool) map_init(&solv->noupdate, solv->installed ? solv->installed->end - solv->installed->start : 0); solv->recommends_index = 0; - solv->decisionmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); + solv->decisionmap = (Id *)solv_calloc(pool->nsolvables, sizeof(Id)); solv->nrules = 1; - solv->rules = sat_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); memset(solv->rules, 0, sizeof(Rule)); return solv; @@ -1329,14 +1329,14 @@ solver_free(Solver *solv) map_free(&solv->droporphanedmap); map_free(&solv->cleandepsmap); - sat_free(solv->decisionmap); - sat_free(solv->rules); - sat_free(solv->watches); - sat_free(solv->obsoletes); - sat_free(solv->obsoletes_data); - sat_free(solv->multiversionupdaters); - sat_free(solv->choicerules_ref); - sat_free(solv); + solv_free(solv->decisionmap); + solv_free(solv->rules); + solv_free(solv->watches); + solv_free(solv->obsoletes); + solv_free(solv->obsoletes_data); + solv_free(solv->multiversionupdaters); + solv_free(solv->choicerules_ref); + solv_free(solv); } int @@ -1431,19 +1431,19 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) int minimizationsteps; int installedpos = solv->installed ? solv->installed->start : 0; - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG (SAT_DEBUG_RULE_CREATION, "number of rules: %d\n", solv->nrules); + POOL_DEBUG (SOLV_DEBUG_RULE_CREATION, "number of rules: %d\n", solv->nrules); for (i = 1; i < solv->nrules; i++) - solver_printruleclass(solv, SAT_DEBUG_RULE_CREATION, solv->rules + i); + solver_printruleclass(solv, SOLV_DEBUG_RULE_CREATION, solv->rules + i); } - POOL_DEBUG(SAT_DEBUG_SOLVER, "initial decisions: %d\n", solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "initial decisions: %d\n", solv->decisionq.count); /* start SAT algorithm */ level = 1; systemlevel = level + 1; - POOL_DEBUG(SAT_DEBUG_SOLVER, "solving...\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "solving...\n"); queue_init(&dq); queue_init(&dqs); @@ -1468,7 +1468,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) */ if (level == 1) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count); if ((r = propagate(solv, level)) != 0) { if (analyze_unsolvable(solv, r, disablerules)) @@ -1483,7 +1483,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) */ if (level < systemlevel) { - POOL_DEBUG(SAT_DEBUG_SOLVER, "resolving job rules\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "resolving job rules\n"); for (i = solv->jobrules, r = solv->rules + i; i < solv->jobrules_end; i++, r++) { Id l; @@ -1551,7 +1551,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) Repo *installed = solv->installed; int pass; - POOL_DEBUG(SAT_DEBUG_SOLVER, "resolving installed packages\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "resolving installed packages\n"); /* we use two passes if we need to update packages * to create a better user experience */ for (pass = solv->updatemap.size ? 0 : 1; pass < 2; pass++) @@ -1654,12 +1654,12 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) olevel = level; if (solv->cleandepsmap.size && MAPTST(&solv->cleandepsmap, i - installed->start)) { - POOL_DEBUG(SAT_DEBUG_POLICY, "cleandeps erasing %s\n", pool_solvid2str(pool, i)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "cleandeps erasing %s\n", pool_solvid2str(pool, i)); level = setpropagatelearn(solv, level, -i, disablerules, 0); } else { - POOL_DEBUG(SAT_DEBUG_POLICY, "keeping %s\n", pool_solvid2str(pool, i)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "keeping %s\n", pool_solvid2str(pool, i)); level = setpropagatelearn(solv, level, i, disablerules, r - solv->rules); } if (level == 0) @@ -1697,7 +1697,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) * decide */ solv->decisioncnt_resolve = solv->decisionq.count; - POOL_DEBUG(SAT_DEBUG_POLICY, "deciding unresolved rules\n"); + POOL_DEBUG(SOLV_DEBUG_POLICY, "deciding unresolved rules\n"); for (i = 1, n = 1; n < solv->nrules; i++, n++) { if (i == solv->nrules) @@ -1756,10 +1756,10 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) if (p) continue; } - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "unfulfilled "); - solver_printruleclass(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "unfulfilled "); + solver_printruleclass(solv, SOLV_DEBUG_PROPAGATE, r); } /* dq.count < 2 cannot happen as this means that * the rule is unit */ @@ -1789,7 +1789,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) { int qcount; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended packages\n"); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended packages\n"); queue_empty(&dq); /* recommended packages */ queue_empty(&dqs); /* supplemented packages */ for (i = 1; i < pool->nsolvables; i++) @@ -1952,9 +1952,9 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) /* simple case, just one package. no need to choose */ p = dq.elements[0]; if (dqs.count) - POOL_DEBUG(SAT_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); else - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); level = setpropagatelearn(solv, level, p, 0, 0); if (level == 0) @@ -1976,7 +1976,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) p = dqs.elements[i]; if (solv->decisionmap[p] || !MAPTST(&dqmap, p)) continue; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); olevel = level; level = setpropagatelearn(solv, level, p, 0, 0); @@ -2029,7 +2029,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) queue_push(&solv->branches, -level); } p = dq.elements[0]; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); olevel = level; level = setpropagatelearn(solv, level, p, 0, 0); @@ -2052,7 +2052,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) int installedone = 0; /* let's see if we can install some unsupported package */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "deciding orphaned packages\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "deciding orphaned packages\n"); for (i = 0; i < solv->orphaned.count; i++) { p = solv->orphaned.elements[i]; @@ -2063,7 +2063,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) continue; if (solv->droporphanedmap.size && MAPTST(&solv->droporphanedmap, p - solv->installed->start)) continue; - POOL_DEBUG(SAT_DEBUG_SOLVER, "keeping orphaned %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "keeping orphaned %s\n", pool_solvid2str(pool, p)); level = setpropagatelearn(solv, level, p, 0, 0); installedone = 1; if (level < olevel) @@ -2082,7 +2082,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) p = solv->orphaned.elements[i]; if (solv->decisionmap[p]) continue; /* already decided */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "removing orphaned %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "removing orphaned %s\n", pool_solvid2str(pool, p)); olevel = level; level = setpropagatelearn(solv, level, -p, 0, 0); if (level < olevel) @@ -2109,7 +2109,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) if (solv->branches.elements[i - 1] < 0) break; p = solv->branches.elements[i]; - POOL_DEBUG(SAT_DEBUG_SOLVER, "branching with %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "branching with %s\n", pool_solvid2str(pool, p)); queue_empty(&dq); for (j = i + 1; j < solv->branches.count; j++) queue_push(&dq, solv->branches.elements[j]); @@ -2154,7 +2154,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) /* kill old solvable so that we do not loop */ p = solv->branches.elements[lasti]; solv->branches.elements[lasti] = 0; - POOL_DEBUG(SAT_DEBUG_SOLVER, "minimizing %d -> %d with %s\n", solv->decisionmap[p], lastl, pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "minimizing %d -> %d with %s\n", solv->decisionmap[p], lastl, pool_solvid2str(pool, p)); minimizationsteps++; level = lastl; @@ -2172,9 +2172,9 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) break; } - POOL_DEBUG(SAT_DEBUG_STATS, "solver statistics: %d learned rules, %d unsolvable, %d minimization steps\n", solv->stats_learned, solv->stats_unsolvable, minimizationsteps); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver statistics: %d learned rules, %d unsolvable, %d minimization steps\n", solv->stats_learned, solv->stats_unsolvable, minimizationsteps); - POOL_DEBUG(SAT_DEBUG_STATS, "done solving.\n\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "done solving.\n\n"); queue_free(&dq); queue_free(&dqs); if (level == 0) @@ -2187,7 +2187,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) solv->decisioncnt_orphan = solv->decisionq.count; } #if 0 - solver_printdecisionq(solv, SAT_DEBUG_RESULT); + solver_printdecisionq(solv, SOLV_DEBUG_RESULT); #endif } @@ -2230,7 +2230,7 @@ removedisabledconflicts(Solver *solv, Queue *removed) if (r->d < 0 && decisionmap[-p]) { /* rule is now disabled, remove from decisionmap */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "removing conflict for package %s[%d]\n", pool_solvid2str(pool, -p), -p); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "removing conflict for package %s[%d]\n", pool_solvid2str(pool, -p), -p); queue_push(removed, -p); queue_push(removed, decisionmap[-p]); decisionmap[-p] = 0; @@ -2293,7 +2293,7 @@ removedisabledconflicts(Solver *solv, Queue *removed) } if (new) { - POOL_DEBUG(SAT_DEBUG_SOLVER, "re-conflicting package %s[%d]\n", pool_solvid2str(pool, -new), -new); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "re-conflicting package %s[%d]\n", pool_solvid2str(pool, -new), -new); decisionmap[-new] = -1; new = 0; n = 0; /* redo all rules */ @@ -2586,16 +2586,16 @@ solver_solve(Solver *solv, Queue *job) int now, solve_start; int hasdupjob = 0; - solve_start = sat_timems(0); + solve_start = solv_timems(0); /* log solver options */ - POOL_DEBUG(SAT_DEBUG_STATS, "solver started\n"); - POOL_DEBUG(SAT_DEBUG_STATS, "fixsystem=%d updatesystem=%d dosplitprovides=%d, noupdateprovide=%d noinfarchcheck=%d\n", solv->fixsystem, solv->updatesystem, solv->dosplitprovides, solv->noupdateprovide, solv->noinfarchcheck); - POOL_DEBUG(SAT_DEBUG_STATS, "distupgrade=%d distupgrade_removeunsupported=%d\n", solv->distupgrade, solv->distupgrade_removeunsupported); - POOL_DEBUG(SAT_DEBUG_STATS, "allowuninstall=%d, allowdowngrade=%d, allowarchchange=%d, allowvendorchange=%d\n", solv->allowuninstall, solv->allowdowngrade, solv->allowarchchange, solv->allowvendorchange); - POOL_DEBUG(SAT_DEBUG_STATS, "promoteepoch=%d, allowselfconflicts=%d\n", pool->promoteepoch, pool->allowselfconflicts); - POOL_DEBUG(SAT_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d, obsoleteusescolors=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides, pool->obsoleteusescolors); - POOL_DEBUG(SAT_DEBUG_STATS, "dontinstallrecommended=%d, ignorealreadyrecommended=%d, dontshowinstalledrecommended=%d\n", solv->dontinstallrecommended, solv->ignorealreadyrecommended, solv->dontshowinstalledrecommended); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver started\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "fixsystem=%d updatesystem=%d dosplitprovides=%d, noupdateprovide=%d noinfarchcheck=%d\n", solv->fixsystem, solv->updatesystem, solv->dosplitprovides, solv->noupdateprovide, solv->noinfarchcheck); + POOL_DEBUG(SOLV_DEBUG_STATS, "distupgrade=%d distupgrade_removeunsupported=%d\n", solv->distupgrade, solv->distupgrade_removeunsupported); + POOL_DEBUG(SOLV_DEBUG_STATS, "allowuninstall=%d, allowdowngrade=%d, allowarchchange=%d, allowvendorchange=%d\n", solv->allowuninstall, solv->allowdowngrade, solv->allowarchchange, solv->allowvendorchange); + POOL_DEBUG(SOLV_DEBUG_STATS, "promoteepoch=%d, allowselfconflicts=%d\n", pool->promoteepoch, pool->allowselfconflicts); + POOL_DEBUG(SOLV_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d, obsoleteusescolors=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides, pool->obsoleteusescolors); + POOL_DEBUG(SOLV_DEBUG_STATS, "dontinstallrecommended=%d, ignorealreadyrecommended=%d, dontshowinstalledrecommended=%d\n", solv->dontinstallrecommended, solv->ignorealreadyrecommended, solv->dontshowinstalledrecommended); /* create whatprovides if not already there */ if (!pool->whatprovides) @@ -2628,7 +2628,7 @@ solver_solve(Solver *solv, Queue *job) map_init(&installcandidatemap, pool->nsolvables); queue_init(&q); - now = sat_timems(0); + now = solv_timems(0); /* * create rules for all package that could be involved with the solving * so called: rpm rules @@ -2678,11 +2678,11 @@ solver_solve(Solver *solv, Queue *job) oldnrules = solv->nrules; FOR_REPO_SOLVABLES(installed, p, s) solver_addrpmrulesforsolvable(solv, s, &addedmap); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules); oldnrules = solv->nrules; FOR_REPO_SOLVABLES(installed, p, s) solver_addrpmrulesforupdaters(solv, s, &addedmap, 1); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules); } /* @@ -2719,7 +2719,7 @@ solver_solve(Solver *solv, Queue *job) break; } } - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules); /* @@ -2727,7 +2727,7 @@ solver_solve(Solver *solv, Queue *job) */ oldnrules = solv->nrules; solver_addrpmrulesforweak(solv, &addedmap); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules); /* * first pass done, we now have all the rpm rules we need. @@ -2737,7 +2737,7 @@ solver_solve(Solver *solv, Queue *job) * as an empty system (remove all packages) is a valid solution */ - IF_POOLDEBUG (SAT_DEBUG_STATS) + IF_POOLDEBUG (SOLV_DEBUG_STATS) { int possible = 0, installable = 0; for (i = 1; i < pool->nsolvables; i++) @@ -2747,14 +2747,14 @@ solver_solve(Solver *solv, Queue *job) if (MAPTST(&addedmap, i)) possible++; } - POOL_DEBUG(SAT_DEBUG_STATS, "%d of %d installable solvables considered for solving\n", possible, installable); + POOL_DEBUG(SOLV_DEBUG_STATS, "%d of %d installable solvables considered for solving\n", possible, installable); } solver_unifyrules(solv); /* remove duplicate rpm rules */ solv->rpmrules_end = solv->nrules; /* mark end of rpm rules */ - POOL_DEBUG(SAT_DEBUG_STATS, "rpm rule memory usage: %d K\n", solv->nrules * (int)sizeof(Rule) / 1024); - POOL_DEBUG(SAT_DEBUG_STATS, "rpm rule creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "rpm rule memory usage: %d K\n", solv->nrules * (int)sizeof(Rule) / 1024); + POOL_DEBUG(SOLV_DEBUG_STATS, "rpm rule creation took %d ms\n", solv_timems(now)); /* create dup maps if needed. We need the maps early to create our * update rules */ @@ -2873,7 +2873,7 @@ solver_solve(Solver *solv, Queue *job) switch (how & SOLVER_JOBMASK) { case SOLVER_INSTALL: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sinstall %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sinstall %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); if (select == SOLVER_SOLVABLE) { p = what; @@ -2895,7 +2895,7 @@ solver_solve(Solver *solv, Queue *job) solver_addjobrule(solv, p, d, i, weak); break; case SOLVER_ERASE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %s%serase %s\n", weak ? "weak " : "", how & SOLVER_CLEANDEPS ? "clean deps " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %s%serase %s\n", weak ? "weak " : "", how & SOLVER_CLEANDEPS ? "clean deps " : "", solver_select2str(pool, select, what)); if ((how & SOLVER_CLEANDEPS) != 0 && !solv->cleandepsmap.size && solv->installed) map_grow(&solv->cleandepsmap, solv->installed->end - solv->installed->start); if (select == SOLVER_SOLVABLE && solv->installed && pool->solvables[what].repo == solv->installed) @@ -2926,23 +2926,23 @@ solver_solve(Solver *solv, Queue *job) break; case SOLVER_UPDATE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %supdate %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %supdate %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_VERIFY: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sverify %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sverify %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_WEAKENDEPS: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sweaken deps %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sweaken deps %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); if (select != SOLVER_SOLVABLE) break; s = pool->solvables + what; weaken_solvable_deps(solv, what); break; case SOLVER_NOOBSOLETES: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sno obsolete %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sno obsolete %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_LOCK: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %slock %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %slock %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); FOR_JOB_SELECT(p, pp, select, what) { s = pool->solvables + p; @@ -2950,10 +2950,10 @@ solver_solve(Solver *solv, Queue *job) } break; case SOLVER_DISTUPGRADE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: distupgrade %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: distupgrade %s\n", solver_select2str(pool, select, what)); break; case SOLVER_DROP_ORPHANED: - POOL_DEBUG(SAT_DEBUG_JOB, "job: drop orphaned %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: drop orphaned %s\n", solver_select2str(pool, select, what)); if (select == SOLVER_SOLVABLE_ALL) solv->droporphanedmap_all = 1; FOR_JOB_SELECT(p, pp, select, what) @@ -2967,10 +2967,10 @@ solver_solve(Solver *solv, Queue *job) } break; case SOLVER_USERINSTALLED: - POOL_DEBUG(SAT_DEBUG_JOB, "job: user installed %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: user installed %s\n", solver_select2str(pool, select, what)); break; default: - POOL_DEBUG(SAT_DEBUG_JOB, "job: unknown job\n"); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: unknown job\n"); break; } @@ -2978,15 +2978,15 @@ solver_solve(Solver *solv, Queue *job) * debug */ - IF_POOLDEBUG (SAT_DEBUG_JOB) + IF_POOLDEBUG (SOLV_DEBUG_JOB) { int j; if (solv->nrules == oldnrules) - POOL_DEBUG(SAT_DEBUG_JOB, " - no rule created\n"); + POOL_DEBUG(SOLV_DEBUG_JOB, " - no rule created\n"); for (j = oldnrules; j < solv->nrules; j++) { - POOL_DEBUG(SAT_DEBUG_JOB, " - job "); - solver_printrule(solv, SAT_DEBUG_JOB, solv->rules + j); + POOL_DEBUG(SOLV_DEBUG_JOB, " - job "); + solver_printrule(solv, SOLV_DEBUG_JOB, solv->rules + j); } } } @@ -3031,7 +3031,7 @@ solver_solve(Solver *solv, Queue *job) map_free(&installcandidatemap); queue_free(&q); - POOL_DEBUG(SAT_DEBUG_STATS, "%d rpm rules, %d job rules, %d infarch rules, %d dup rules, %d choice rules\n", solv->rpmrules_end - 1, solv->jobrules_end - solv->jobrules, solv->infarchrules_end - solv->infarchrules, solv->duprules_end - solv->duprules, solv->choicerules_end - solv->choicerules); + POOL_DEBUG(SOLV_DEBUG_STATS, "%d rpm rules, %d job rules, %d infarch rules, %d dup rules, %d choice rules\n", solv->rpmrules_end - 1, solv->jobrules_end - solv->jobrules, solv->infarchrules_end - solv->infarchrules, solv->duprules_end - solv->duprules, solv->choicerules_end - solv->choicerules); /* create weak map */ map_init(&solv->weakrulemap, solv->nrules); @@ -3058,7 +3058,7 @@ solver_solve(Solver *solv, Queue *job) /* make initial decisions based on assertion rules */ makeruledecisions(solv); - POOL_DEBUG(SAT_DEBUG_SOLVER, "problems so far: %d\n", solv->problems.count); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "problems so far: %d\n", solv->problems.count); /* * ******************************************** @@ -3066,9 +3066,9 @@ solver_solve(Solver *solv, Queue *job) * ******************************************** */ - now = sat_timems(0); + now = solv_timems(0); solver_run_sat(solv, 1, solv->dontinstallrecommended ? 0 : 1); - POOL_DEBUG(SAT_DEBUG_STATS, "solver took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver took %d ms\n", solv_timems(now)); /* * calculate recommended/suggested packages @@ -3080,8 +3080,8 @@ solver_solve(Solver *solv, Queue *job) */ solver_prepare_solutions(solv); - POOL_DEBUG(SAT_DEBUG_STATS, "final solver statistics: %d problems, %d learned rules, %d unsolvable\n", solv->problems.count / 2, solv->stats_learned, solv->stats_unsolvable); - POOL_DEBUG(SAT_DEBUG_STATS, "solver_solve took %d ms\n", sat_timems(solve_start)); + POOL_DEBUG(SOLV_DEBUG_STATS, "final solver statistics: %d problems, %d learned rules, %d unsolvable\n", solv->problems.count / 2, solv->stats_learned, solv->stats_unsolvable); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver_solve took %d ms\n", solv_timems(solve_start)); /* return number of problems */ return solv->problems.count ? solv->problems.count / 2 : 0; diff --git a/src/solverdebug.c b/src/solverdebug.c index cd7183b..099b39e 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -50,7 +50,7 @@ solver_create_decisions_obsoletesmap(Solver *solv) int i; Solvable *s; - obsoletesmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); + obsoletesmap = (Id *)solv_calloc(pool->nsolvables, sizeof(Id)); if (installed) { for (i = 0; i < solv->decisionq.count; i++) @@ -230,19 +230,19 @@ solver_printproblem(Solver *solv, Id v) Id *jp; if (v > 0) - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, solv->rules + v); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, solv->rules + v); else { v = -(v + 1); - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "JOB %d\n", v); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "JOB %d\n", v); jp = solv->ruletojob.elements; for (i = solv->jobrules, r = solv->rules + i; i < solv->jobrules_end; i++, r++, jp++) if (*jp == v) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "- "); - solver_printrule(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "- "); + solver_printrule(solv, SOLV_DEBUG_SOLUTIONS, r); } - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "ENDJOB\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "ENDJOB\n"); } } @@ -303,8 +303,8 @@ solver_printdecisions(Solver *solv) Solvable *s; Queue iq; - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); - POOL_DEBUG(SAT_DEBUG_RESULT, "transaction:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "transaction:\n"); queue_init(&iq); for (i = 0; i < trans->steps.count; i++) @@ -315,29 +315,29 @@ solver_printdecisions(Solver *solv) switch(type) { case SOLVER_TRANSACTION_MULTIINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " multi install %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi install %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_MULTIREINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " multi reinstall %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi reinstall %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_INSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " install %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " install %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_REINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " reinstall %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " reinstall %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_DOWNGRADE: - POOL_DEBUG(SAT_DEBUG_RESULT, " downgrade %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " downgrade %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_CHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, " change %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " change %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_UPGRADE: case SOLVER_TRANSACTION_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, " upgrade %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " upgrade %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_ERASE: - POOL_DEBUG(SAT_DEBUG_RESULT, " erase %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " erase %s", pool_solvable2str(pool, s)); break; default: break; @@ -348,7 +348,7 @@ solver_printdecisions(Solver *solv) case SOLVER_TRANSACTION_ERASE: case SOLVER_TRANSACTION_MULTIINSTALL: case SOLVER_TRANSACTION_MULTIREINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); break; case SOLVER_TRANSACTION_REINSTALL: case SOLVER_TRANSACTION_DOWNGRADE: @@ -358,12 +358,12 @@ solver_printdecisions(Solver *solv) transaction_all_obs_pkgs(trans, p, &iq); if (iq.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, " (obsoletes"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " (obsoletes"); for (j = 0; j < iq.count; j++) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s", pool_solvid2str(pool, iq.elements[j])); - POOL_DEBUG(SAT_DEBUG_RESULT, ")"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s", pool_solvid2str(pool, iq.elements[j])); + POOL_DEBUG(SOLV_DEBUG_RESULT, ")"); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); break; default: break; @@ -371,57 +371,57 @@ solver_printdecisions(Solver *solv) } queue_free(&iq); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); if (solv->recommendations.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "recommended packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "recommended packages:\n"); for (i = 0; i < solv->recommendations.count; i++) { s = pool->solvables + solv->recommendations.elements[i]; if (solv->decisionmap[solv->recommendations.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } if (solv->suggestions.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "suggested packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "suggested packages:\n"); for (i = 0; i < solv->suggestions.count; i++) { s = pool->solvables + solv->suggestions.elements[i]; if (solv->decisionmap[solv->suggestions.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } if (solv->orphaned.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "orphaned packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "orphaned packages:\n"); for (i = 0; i < solv->orphaned.count; i++) { s = pool->solvables + solv->orphaned.elements[i]; if (solv->decisionmap[solv->orphaned.elements[i]] > 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (kept)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (kept)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (erased)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (erased)\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } transaction_free(trans); } @@ -452,28 +452,28 @@ transaction_print(Transaction *trans) switch(class) { case SOLVER_TRANSACTION_ERASE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d erased packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d erased packages:\n", cnt); break; case SOLVER_TRANSACTION_INSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d installed packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d installed packages:\n", cnt); break; case SOLVER_TRANSACTION_REINSTALLED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d reinstalled packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d reinstalled packages:\n", cnt); break; case SOLVER_TRANSACTION_DOWNGRADED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d downgraded packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d downgraded packages:\n", cnt); break; case SOLVER_TRANSACTION_CHANGED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d changed packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d changed packages:\n", cnt); break; case SOLVER_TRANSACTION_UPGRADED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d upgraded packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d upgraded packages:\n", cnt); break; case SOLVER_TRANSACTION_VENDORCHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d vendor changes from '%s' to '%s':\n", cnt, id2strnone(pool, classes.elements[i + 2]), id2strnone(pool, classes.elements[i + 3])); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d vendor changes from '%s' to '%s':\n", cnt, id2strnone(pool, classes.elements[i + 2]), id2strnone(pool, classes.elements[i + 3])); break; case SOLVER_TRANSACTION_ARCHCHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d arch changes from %s to %s:\n", cnt, pool_id2str(pool, classes.elements[i + 2]), pool_id2str(pool, classes.elements[i + 3])); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d arch changes from %s to %s:\n", cnt, pool_id2str(pool, classes.elements[i + 2]), pool_id2str(pool, classes.elements[i + 3])); break; default: class = SOLVER_TRANSACTION_IGNORE; @@ -495,7 +495,7 @@ transaction_print(Transaction *trans) case SOLVER_TRANSACTION_DOWNGRADED: case SOLVER_TRANSACTION_UPGRADED: s2 = pool->solvables + transaction_obs_pkg(trans, p); - POOL_DEBUG(SAT_DEBUG_RESULT, " - %s -> %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s -> %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2)); break; case SOLVER_TRANSACTION_VENDORCHANGE: case SOLVER_TRANSACTION_ARCHCHANGE: @@ -504,12 +504,12 @@ transaction_print(Transaction *trans) if (l + linel > sizeof(line) - 3) { if (*line) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", line); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); *line = 0; linel = 0; } if (l + linel > sizeof(line) - 3) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", n); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", n); else { if (*line) @@ -522,13 +522,13 @@ transaction_print(Transaction *trans) } break; default: - POOL_DEBUG(SAT_DEBUG_RESULT, " - %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s\n", pool_solvable2str(pool, s)); break; } } if (*line) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", line); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } queue_free(&classes); queue_free(&pkgs); @@ -543,55 +543,55 @@ solver_printproblemruleinfo(Solver *solv, Id probr) switch (solver_ruleinfo(solv, probr, &source, &target, &dep)) { case SOLVER_RULE_DISTUPGRADE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%s does not belong to a distupgrade repository\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%s does not belong to a distupgrade repository\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_INFARCH: - POOL_DEBUG(SAT_DEBUG_RESULT, "%s has inferior architecture\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%s has inferior architecture\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_UPDATE: - POOL_DEBUG(SAT_DEBUG_RESULT, "problem with installed package %s\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "problem with installed package %s\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_JOB: - POOL_DEBUG(SAT_DEBUG_RESULT, "conflicting requests\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "conflicting requests\n"); return; case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP: - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides requested %s\n", pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "nothing provides requested %s\n", pool_dep2str(pool, dep)); return; case SOLVER_RULE_RPM: - POOL_DEBUG(SAT_DEBUG_RESULT, "some dependency problem\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "some dependency problem\n"); return; case SOLVER_RULE_RPM_NOT_INSTALLABLE: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s is not installable\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP: - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides %s needed by %s\n", pool_dep2str(pool, dep), pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "nothing provides %s needed by %s\n", pool_dep2str(pool, dep), pool_solvid2str(pool, source)); return; case SOLVER_RULE_RPM_SAME_NAME: - POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", pool_solvid2str(pool, source), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "cannot install both %s and %s\n", pool_solvid2str(pool, source), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_CONFLICT: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "installed package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "installed package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_IMPLICIT_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s implicitely obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s implicitely obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_REQUIRES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); return; case SOLVER_RULE_RPM_SELF_CONFLICT: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); return; case SOLVER_RULE_UNKNOWN: case SOLVER_RULE_FEATURE: case SOLVER_RULE_LEARNT: case SOLVER_RULE_CHOICE: - POOL_DEBUG(SAT_DEBUG_RESULT, "bad rule type\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "bad rule type\n"); return; } } @@ -650,28 +650,28 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { case SOLVER_INSTALL: if (select == SOLVER_SOLVABLE && solv->installed && pool->solvables[what].repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not keep %s installed\n", pool_solvid2str(pool, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not keep %s installed\n", pool_solvid2str(pool, what)); else if (select == SOLVER_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install a solvable %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install a solvable %s\n", solver_select2str(pool, select, what)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install %s\n", solver_select2str(pool, select, what)); break; case SOLVER_ERASE: if (select == SOLVER_SOLVABLE && !(solv->installed && pool->solvables[what].repo == solv->installed)) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not forbid installation of %s\n", pool_solvid2str(pool, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not forbid installation of %s\n", pool_solvid2str(pool, what)); else if (select == SOLVER_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not deinstall all solvables %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not deinstall all solvables %s\n", solver_select2str(pool, select, what)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not deinstall %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not deinstall %s\n", solver_select2str(pool, select, what)); break; case SOLVER_UPDATE: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install most recent version of %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install most recent version of %s\n", solver_select2str(pool, select, what)); break; case SOLVER_LOCK: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not lock %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not lock %s\n", solver_select2str(pool, select, what)); break; default: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do something different\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do something different\n"); break; } } @@ -679,17 +679,17 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { s = pool->solvables + rp; if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - keep %s despite the inferior architecture\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - keep %s despite the inferior architecture\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - install %s despite the inferior architecture\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - install %s despite the inferior architecture\n", pool_solvable2str(pool, s)); } else if (p == SOLVER_SOLUTION_DISTUPGRADE) { s = pool->solvables + rp; if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - keep obsolete %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - keep obsolete %s\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - install %s from excluded repository\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - install %s from excluded repository\n", pool_solvable2str(pool, s)); } else { @@ -700,22 +700,22 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { int illegal = policy_is_illegal(solv, s, sd, 0); if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow downgrade of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow downgrade of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow architecture change of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow architecture change of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0) { if (sd->vendor) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to '%s' (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_id2str(pool, sd->vendor), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to '%s' (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_id2str(pool, sd->vendor), pool_solvable2str(pool, sd)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to no vendor (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to no vendor (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); } if (!illegal) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow replacement of %s with %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow replacement of %s with %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); } else { - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow deinstallation of %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow deinstallation of %s\n", pool_solvable2str(pool, s)); } } } @@ -728,25 +728,25 @@ solver_printallsolutions(Solver *solv) int pcnt; Id problem, solution; - POOL_DEBUG(SAT_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); pcnt = 0; problem = 0; while ((problem = solver_next_problem(solv, problem)) != 0) { pcnt++; - POOL_DEBUG(SAT_DEBUG_RESULT, "Problem %d:\n", pcnt); - POOL_DEBUG(SAT_DEBUG_RESULT, "====================================\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "Problem %d:\n", pcnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "====================================\n"); #if 1 solver_printprobleminfo(solv, problem); #else solver_printcompleteprobleminfo(solv, problem); #endif - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); solution = 0; while ((solution = solver_next_solution(solv, problem, solution)) != 0) { solver_printsolution(solv, problem, solution); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } } } @@ -776,10 +776,10 @@ solver_printtrivial(Solver *solv) } queue_init(&out); solver_trivial_installable(solv, &in, &out); - POOL_DEBUG(SAT_DEBUG_RESULT, "trivial installable status:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "trivial installable status:\n"); for (i = 0; i < in.count; i++) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s: %d\n", pool_solvid2str(pool, in.elements[i]), out.elements[i]); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s: %d\n", pool_solvid2str(pool, in.elements[i]), out.elements[i]); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); queue_free(&in); queue_free(&out); } diff --git a/src/solvversion.c b/src/solvversion.c new file mode 100644 index 0000000..d66e195 --- /dev/null +++ b/src/solvversion.c @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2009, Novell Inc. + * + * This program is licensed under the BSD license, read LICENSE.BSD + * for further information + */ + +#include "solvversion.h" + +const char solv_version[] = LIBSOLV_VERSION_STRING; +int solv_version_major = LIBSOLV_VERSION_MAJOR; +int solv_version_minor = LIBSOLV_VERSION_MINOR; +int solv_version_patch = LIBSOLV_VERSION_PATCH; diff --git a/src/satversion.h.in b/src/solvversion.h.in similarity index 68% rename from src/satversion.h.in rename to src/solvversion.h.in index 1154741..268219c 100644 --- a/src/satversion.h.in +++ b/src/solvversion.h.in @@ -6,12 +6,12 @@ */ /* - * satversion.h + * solvversion.h * */ -#ifndef LIBSOLV_SATVERSION_H -#define LIBSOLV_SATVERSION_H +#ifndef LIBSOLV_SOLVVERSION_H +#define LIBSOLV_SOLVVERSION_H #define LIBSOLV_VERSION_STRING "@VERSION@" #define LIBSOLV_VERSION_MAJOR @LIBSOLV_MAJOR@ @@ -19,9 +19,9 @@ #define LIBSOLV_VERSION_PATCH @LIBSOLV_PATCH@ #define LIBSOLV_VERSION (LIBSOLV_VERSION_MAJOR * 10000 + LIBSOLV_VERSION_MINOR * 100 + LIBSOLV_VERSION_PATCH) -extern const char sat_version[]; -extern int sat_version_major; -extern int sat_version_minor; -extern int sat_version_patch; +extern const char solv_version[]; +extern int solv_version_major; +extern int solv_version_minor; +extern int solv_version_patch; #endif diff --git a/src/strpool.c b/src/strpool.c index d2c7a8a..0b47367 100644 --- a/src/strpool.c +++ b/src/strpool.c @@ -24,8 +24,8 @@ stringpool_init(Stringpool *ss, const char *strs[]) totalsize += strlen(strs[count]) + 1; // alloc appropriate space - ss->stringspace = sat_extend_resize(0, totalsize, 1, STRINGSPACE_BLOCK); - ss->strings = sat_extend_resize(0, count, sizeof(Offset), STRING_BLOCK); + ss->stringspace = solv_extend_resize(0, totalsize, 1, STRINGSPACE_BLOCK); + ss->strings = solv_extend_resize(0, count, sizeof(Offset), STRING_BLOCK); // now copy predefined strings into allocated space ss->sstrings = 0; @@ -41,15 +41,15 @@ stringpool_init(Stringpool *ss, const char *strs[]) void stringpool_free(Stringpool *ss) { - sat_free(ss->strings); - sat_free(ss->stringspace); - sat_free(ss->stringhashtbl); + solv_free(ss->strings); + solv_free(ss->stringspace); + solv_free(ss->stringhashtbl); } void stringpool_freehash(Stringpool *ss) { - ss->stringhashtbl = sat_free(ss->stringhashtbl); + ss->stringhashtbl = solv_free(ss->stringhashtbl); ss->stringhashmask = 0; } @@ -68,9 +68,9 @@ void stringpool_clone(Stringpool *ss, Stringpool *from) { memset(ss, 0, sizeof(*ss)); - ss->strings = sat_extend_resize(0, from->nstrings, sizeof(Offset), STRING_BLOCK); + ss->strings = solv_extend_resize(0, from->nstrings, sizeof(Offset), STRING_BLOCK); memcpy(ss->strings, from->strings, from->nstrings * sizeof(Offset)); - ss->stringspace = sat_extend_resize(0, from->sstrings, 1, STRINGSPACE_BLOCK); + ss->stringspace = solv_extend_resize(0, from->sstrings, 1, STRINGSPACE_BLOCK); memcpy(ss->stringspace, from->stringspace, from->sstrings); ss->nstrings = from->nstrings; ss->sstrings = from->sstrings; @@ -98,11 +98,11 @@ stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create // expand hashtable if needed if (ss->nstrings * 2 > hashmask) { - sat_free(hashtbl); + solv_free(hashtbl); // realloc hash table ss->stringhashmask = hashmask = mkmask(ss->nstrings + STRING_BLOCK); - ss->stringhashtbl = hashtbl = (Hashtable)sat_calloc(hashmask + 1, sizeof(Id)); + ss->stringhashtbl = hashtbl = (Hashtable)solv_calloc(hashmask + 1, sizeof(Id)); // rehash all strings into new hashtable for (i = 1; i < ss->nstrings; i++) @@ -133,11 +133,11 @@ stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create id = ss->nstrings++; hashtbl[h] = id; - ss->strings = sat_extend(ss->strings, id, 1, sizeof(Offset), STRING_BLOCK); + ss->strings = solv_extend(ss->strings, id, 1, sizeof(Offset), STRING_BLOCK); ss->strings[id] = ss->sstrings; /* we will append to the end */ // append string to stringspace - ss->stringspace = sat_extend(ss->stringspace, ss->sstrings, len + 1, 1, STRINGSPACE_BLOCK); + ss->stringspace = solv_extend(ss->stringspace, ss->sstrings, len + 1, 1, STRINGSPACE_BLOCK); memcpy(ss->stringspace + ss->sstrings, str, len); ss->stringspace[ss->sstrings + len] = 0; ss->sstrings += len + 1; @@ -157,6 +157,6 @@ stringpool_str2id(Stringpool *ss, const char *str, int create) void stringpool_shrink(Stringpool *ss) { - ss->stringspace = sat_extend_resize(ss->stringspace, ss->sstrings, 1, STRINGSPACE_BLOCK); - ss->strings = sat_extend_resize(ss->strings, ss->nstrings, sizeof(Offset), STRING_BLOCK); + ss->stringspace = solv_extend_resize(ss->stringspace, ss->sstrings, 1, STRINGSPACE_BLOCK); + ss->strings = solv_extend_resize(ss->strings, ss->nstrings, sizeof(Offset), STRING_BLOCK); } diff --git a/src/transaction.c b/src/transaction.c index 4ef7cd0..f098749 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -89,7 +89,7 @@ transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs) } /* sort obsoleters */ if (pkgs->count > 2) - sat_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); + solv_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); for (i = 0; i < pkgs->count; i += 2) pkgs->elements[i / 2] = pkgs->elements[i + 1]; pkgs->count /= 2; @@ -466,7 +466,7 @@ transaction_classify(Transaction *trans, int mode, Queue *classes) } /* now sort all vendor/arch changes */ if (classes->count > 4) - sat_sort(classes->elements, classes->count / 4, 4 * sizeof(Id), classify_cmp, trans); + solv_sort(classes->elements, classes->count / 4, 4 * sizeof(Id), classify_cmp, trans); /* finally add all classes. put erases last */ i = SOLVER_TRANSACTION_ERASE; if (ntypes[i]) @@ -531,7 +531,7 @@ transaction_classify_pkgs(Transaction *trans, int mode, Id class, Id from, Id to } } if (pkgs->count > 1) - sat_sort(pkgs->elements, pkgs->count, sizeof(Id), classify_cmp_pkgs, trans); + solv_sort(pkgs->elements, pkgs->count, sizeof(Id), classify_cmp_pkgs, trans); } static void @@ -545,7 +545,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) Solvable *s, *s2; queue_empty(ti); - trans->transaction_installed = sat_free(trans->transaction_installed); + trans->transaction_installed = solv_free(trans->transaction_installed); if (!installed) return; /* no info needed */ for (i = 0; i < decisionq->count; i++) @@ -593,7 +593,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) } } } - sat_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); + solv_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); /* now unify */ for (i = j = 0; i < ti->count; i += 2) { @@ -605,7 +605,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) ti->count = j; /* create transaction_installed helper */ - trans->transaction_installed = sat_calloc(installed->end - installed->start, sizeof(Id)); + trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); for (i = 0; i < ti->count; i += 2) { j = ti->elements[i + 1] - installed->start; @@ -793,7 +793,7 @@ struct _TransactionOrderdata { Transaction * transaction_create(Pool *pool) { - Transaction *trans = sat_calloc(1, sizeof(*trans)); + Transaction *trans = solv_calloc(1, sizeof(*trans)); trans->pool = pool; return trans; } @@ -807,7 +807,7 @@ transaction_create_clone(Transaction *srctrans) if (srctrans->transaction_installed) { Repo *installed = srctrans->pool->installed; - trans->transaction_installed = sat_calloc(installed->end - installed->start, sizeof(Id)); + trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); memcpy(trans->transaction_installed, srctrans->transaction_installed, (installed->end - installed->start) * sizeof(Id)); } map_init_clone(&trans->transactsmap, &srctrans->transactsmap); @@ -815,11 +815,11 @@ transaction_create_clone(Transaction *srctrans) if (srctrans->orderdata) { struct _TransactionOrderdata *od = srctrans->orderdata; - trans->orderdata = sat_calloc(1, sizeof(*trans->orderdata)); - trans->orderdata->tes = sat_malloc2(od->ntes, sizeof(*od->tes)); + trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata)); + trans->orderdata->tes = solv_malloc2(od->ntes, sizeof(*od->tes)); memcpy(trans->orderdata->tes, od->tes, od->ntes * sizeof(*od->tes)); trans->orderdata->ntes = od->ntes; - trans->orderdata->invedgedata = sat_malloc2(od->ninvedgedata, sizeof(Id)); + trans->orderdata->invedgedata = solv_malloc2(od->ninvedgedata, sizeof(Id)); memcpy(trans->orderdata->invedgedata, od->invedgedata, od->ninvedgedata * sizeof(Id)); trans->orderdata->ninvedgedata = od->ninvedgedata; } @@ -831,7 +831,7 @@ transaction_free(Transaction *trans) { queue_free(&trans->steps); queue_free(&trans->transaction_info); - trans->transaction_installed = sat_free(trans->transaction_installed); + trans->transaction_installed = solv_free(trans->transaction_installed); map_free(&trans->transactsmap); map_free(&trans->noobsmap); transaction_free_orderdata(trans); @@ -844,9 +844,9 @@ transaction_free_orderdata(Transaction *trans) if (trans->orderdata) { struct _TransactionOrderdata *od = trans->orderdata; - od->tes = sat_free(od->tes); - od->invedgedata = sat_free(od->invedgedata); - trans->orderdata = sat_free(trans->orderdata); + od->tes = solv_free(od->tes); + od->invedgedata = solv_free(od->invedgedata); + trans->orderdata = solv_free(trans->orderdata); } } @@ -891,12 +891,12 @@ addteedge(struct orderdata *od, int from, int to, int type) /* printf("tail add %d\n", i - te->edges); */ if (!i) te->edges = ++i; - od->edgedata = sat_extend(od->edgedata, od->nedgedata, 3, sizeof(Id), EDGEDATA_BLOCK); + od->edgedata = solv_extend(od->edgedata, od->nedgedata, 3, sizeof(Id), EDGEDATA_BLOCK); } else { /* printf("extend %d\n", i - te->edges); */ - od->edgedata = sat_extend(od->edgedata, od->nedgedata, 3 + (i - te->edges), sizeof(Id), EDGEDATA_BLOCK); + od->edgedata = solv_extend(od->edgedata, od->nedgedata, 3 + (i - te->edges), sizeof(Id), EDGEDATA_BLOCK); if (i > te->edges) memcpy(od->edgedata + od->nedgedata, od->edgedata + te->edges, sizeof(Id) * (i - te->edges)); i = od->nedgedata + (i - te->edges); @@ -1345,17 +1345,17 @@ breakcycle(struct orderdata *od, Id *cycle) /* cycle recorded, print it */ if (ddegmin >= TYPE_REQ && (ddegmax & TYPE_PREREQ) != 0) - POOL_DEBUG(SAT_DEBUG_STATS, "CRITICAL "); - POOL_DEBUG(SAT_DEBUG_STATS, "cycle: --> "); + POOL_DEBUG(SOLV_DEBUG_STATS, "CRITICAL "); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle: --> "); for (k = 0; cycle[k + 1]; k += 2) { te = od->tes + cycle[k]; if ((od->edgedata[cycle[k + 1] + 1] & TYPE_BROKEN) != 0) - POOL_DEBUG(SAT_DEBUG_STATS, "%s ##%x##> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s ##%x##> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); else - POOL_DEBUG(SAT_DEBUG_STATS, "%s --%x--> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s --%x--> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); } - POOL_DEBUG(SAT_DEBUG_STATS, "\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "\n"); } static inline void @@ -1370,21 +1370,21 @@ dump_tes(struct orderdata *od) for (i = 1, te = od->tes + i; i < od->ntes; i++, te++) { Solvable *s = pool->solvables + te->p; - POOL_DEBUG(SAT_DEBUG_RESULT, "TE %4d: %c%s\n", i, s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "TE %4d: %c%s\n", i, s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); if (s->repo != pool->installed) { queue_empty(&obsq); transaction_all_obs_pkgs(od->trans, te->p, &obsq); for (j = 0; j < obsq.count; j++) - POOL_DEBUG(SAT_DEBUG_RESULT, " -%s\n", pool_solvid2str(pool, obsq.elements[j])); + POOL_DEBUG(SOLV_DEBUG_RESULT, " -%s\n", pool_solvid2str(pool, obsq.elements[j])); } for (j = te->edges; od->edgedata[j]; j += 2) { te2 = od->tes + od->edgedata[j]; if ((od->edgedata[j + 1] & TYPE_BROKEN) == 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " --%x--> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " --%x--> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " ##%x##> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " ##%x##> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); } } } @@ -1556,15 +1556,15 @@ transaction_order(Transaction *trans, int flags) int lastmedia; Id *temedianr; - start = now = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "ordering transaction\n"); + start = now = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "ordering transaction\n"); /* free old data if present */ if (trans->orderdata) { struct _TransactionOrderdata *od = trans->orderdata; - od->tes = sat_free(od->tes); - od->invedgedata = sat_free(od->invedgedata); - trans->orderdata = sat_free(trans->orderdata); + od->tes = solv_free(od->tes); + od->invedgedata = solv_free(od->invedgedata); + trans->orderdata = solv_free(trans->orderdata); } /* create a transaction element for every active component */ @@ -1577,7 +1577,7 @@ transaction_order(Transaction *trans, int flags) continue; numte++; } - POOL_DEBUG(SAT_DEBUG_STATS, "transaction elements: %d\n", numte); + POOL_DEBUG(SOLV_DEBUG_STATS, "transaction elements: %d\n", numte); if (!numte) return; /* nothing to do... */ @@ -1585,8 +1585,8 @@ transaction_order(Transaction *trans, int flags) memset(&od, 0, sizeof(od)); od.trans = trans; od.ntes = numte; - od.tes = sat_calloc(numte, sizeof(*od.tes)); - od.edgedata = sat_extend(0, 0, 1, sizeof(Id), EDGEDATA_BLOCK); + od.tes = solv_calloc(numte, sizeof(*od.tes)); + od.edgedata = solv_extend(0, 0, 1, sizeof(Id), EDGEDATA_BLOCK); od.edgedata[0] = 0; od.nedgedata = 1; queue_init(&od.cycles); @@ -1611,14 +1611,14 @@ transaction_order(Transaction *trans, int flags) for (i = 1, te = od.tes + i; i < numte; i++, te++) for (j = te->edges; od.edgedata[j]; j += 2) numedge++; - POOL_DEBUG(SAT_DEBUG_STATS, "edges: %d, edge space: %d\n", numedge, od.nedgedata / 2); - POOL_DEBUG(SAT_DEBUG_STATS, "edge creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "edges: %d, edge space: %d\n", numedge, od.nedgedata / 2); + POOL_DEBUG(SOLV_DEBUG_STATS, "edge creation took %d ms\n", solv_timems(now)); #if 0 dump_tes(&od); #endif - now = sat_timems(0); + now = solv_timems(0); /* kill all cycles */ queue_init(&todo); for (i = numte - 1; i > 0; i--) @@ -1696,10 +1696,10 @@ transaction_order(Transaction *trans, int flags) /* restart with start of cycle */ todo.count = cycstart + 1; } - POOL_DEBUG(SAT_DEBUG_STATS, "cycles broken: %d\n", od.ncycles); - POOL_DEBUG(SAT_DEBUG_STATS, "cycle breaking took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycles broken: %d\n", od.ncycles); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle breaking took %d ms\n", solv_timems(now)); - now = sat_timems(0); + now = solv_timems(0); /* now go through all broken cycles and create cycle edges to help the ordering */ for (i = od.cycles.count - 3; i >= 0; i -= 3) @@ -1712,14 +1712,14 @@ transaction_order(Transaction *trans, int flags) if (od.cycles.elements[i + 2] < TYPE_REQ) addcycleedges(&od, od.cyclesdata.elements + od.cycles.elements[i], &todo); } - POOL_DEBUG(SAT_DEBUG_STATS, "cycle edge creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle edge creation took %d ms\n", solv_timems(now)); #if 0 dump_tes(&od); #endif /* all edges are finally set up and there are no cycles, now the easy part. * Create an ordered transaction */ - now = sat_timems(0); + now = solv_timems(0); /* first invert all edges */ for (i = 1, te = od.tes + i; i < numte; i++, te++) te->mark = 1; /* term 0 */ @@ -1738,8 +1738,8 @@ transaction_order(Transaction *trans, int flags) te->mark += j; j = te->mark; } - POOL_DEBUG(SAT_DEBUG_STATS, "invedge space: %d\n", j + 1); - od.invedgedata = sat_calloc(j + 1, sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "invedge space: %d\n", j + 1); + od.invedgedata = solv_calloc(j + 1, sizeof(Id)); for (i = 1, te = od.tes + i; i < numte; i++, te++) { for (j = te->edges; od.edgedata[j]; j += 2) @@ -1751,7 +1751,7 @@ transaction_order(Transaction *trans, int flags) } for (i = 1, te = od.tes + i; i < numte; i++, te++) te->edges = te->mark; /* edges now points into invedgedata */ - od.edgedata = sat_free(od.edgedata); + od.edgedata = solv_free(od.edgedata); od.nedgedata = j + 1; /* now the final ordering */ @@ -1780,7 +1780,7 @@ transaction_order(Transaction *trans, int flags) lastrepo = 0; lastmedia = 0; - temedianr = sat_calloc(numte, sizeof(Id)); + temedianr = solv_calloc(numte, sizeof(Id)); for (i = 1; i < numte; i++) { Solvable *s = pool->solvables + od.tes[i].p; @@ -1852,7 +1852,7 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata } } } - sat_free(temedianr); + solv_free(temedianr); queue_free(&todo); queue_free(&samerepoq); queue_free(&uninstq); @@ -1864,12 +1864,12 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata transaction_add_obsoleted(trans); assert(tr->count == oldcount); - POOL_DEBUG(SAT_DEBUG_STATS, "creating new transaction took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "transaction ordering took %d ms\n", sat_timems(start)); + POOL_DEBUG(SOLV_DEBUG_STATS, "creating new transaction took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "transaction ordering took %d ms\n", solv_timems(start)); if ((flags & SOLVER_TRANSACTION_KEEP_ORDERDATA) != 0) { - trans->orderdata = sat_calloc(1, sizeof(*trans->orderdata)); + trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata)); trans->orderdata->tes = od.tes; trans->orderdata->ntes = numte; trans->orderdata->invedgedata = od.invedgedata; @@ -1877,8 +1877,8 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata } else { - sat_free(od.tes); - sat_free(od.invedgedata); + solv_free(od.tes); + solv_free(od.invedgedata); } } @@ -2049,7 +2049,7 @@ transaction_check_pkg(Transaction *trans, Id tepkg, Id pkg, Map *ins, Map *seen, } if (!good) { - POOL_DEBUG(SAT_DEBUG_RESULT, " %c%s: nothing provides %s needed by %c%s\n", pool->solvables[tepkg].repo == pool->installed ? '-' : '+', pool_solvid2str(pool, tepkg), pool_dep2str(pool, req), s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %c%s: nothing provides %s needed by %c%s\n", pool->solvables[tepkg].repo == pool->installed ? '-' : '+', pool_solvid2str(pool, tepkg), pool_dep2str(pool, req), s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); } } } @@ -2064,7 +2064,7 @@ transaction_check_order(Transaction *trans) Map ins, seen; int i; - POOL_DEBUG(SAT_WARN, "\nchecking transaction order...\n"); + POOL_DEBUG(SOLV_WARN, "\nchecking transaction order...\n"); map_init(&ins, pool->nsolvables); map_init(&seen, pool->nsolvables); if (pool->installed) @@ -2089,5 +2089,5 @@ transaction_check_order(Transaction *trans) } map_free(&seen); map_free(&ins); - POOL_DEBUG(SAT_WARN, "transaction order check done.\n"); + POOL_DEBUG(SOLV_WARN, "transaction order check done.\n"); } diff --git a/src/util.c b/src/util.c index a08f4ce..f47079c 100644 --- a/src/util.c +++ b/src/util.c @@ -16,7 +16,7 @@ #include "util.h" void -sat_oom(size_t num, size_t len) +solv_oom(size_t num, size_t len) { if (num) fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len); @@ -27,44 +27,44 @@ sat_oom(size_t num, size_t len) } void * -sat_malloc(size_t len) +solv_malloc(size_t len) { void *r = malloc(len ? len : 1); if (!r) - sat_oom(0, len); + solv_oom(0, len); return r; } void * -sat_malloc2(size_t num, size_t len) +solv_malloc2(size_t num, size_t len) { if (len && (num * len) / len != num) - sat_oom(num, len); - return sat_malloc(num * len); + solv_oom(num, len); + return solv_malloc(num * len); } void * -sat_realloc(void *old, size_t len) +solv_realloc(void *old, size_t len) { if (old == 0) old = malloc(len ? len : 1); else old = realloc(old, len ? len : 1); if (!old) - sat_oom(0, len); + solv_oom(0, len); return old; } void * -sat_realloc2(void *old, size_t num, size_t len) +solv_realloc2(void *old, size_t num, size_t len) { if (len && (num * len) / len != num) - sat_oom(num, len); - return sat_realloc(old, num * len); + solv_oom(num, len); + return solv_realloc(old, num * len); } void * -sat_calloc(size_t num, size_t len) +solv_calloc(size_t num, size_t len) { void *r; if (num == 0 || len == 0) @@ -72,12 +72,12 @@ sat_calloc(size_t num, size_t len) else r = calloc(num, len); if (!r) - sat_oom(num, len); + solv_oom(num, len); return r; } void * -sat_free(void *mem) +solv_free(void *mem) { if (mem) free(mem); @@ -85,7 +85,7 @@ sat_free(void *mem) } unsigned int -sat_timems(unsigned int subtract) +solv_timems(unsigned int subtract) { struct timeval tv; unsigned int r; @@ -107,7 +107,7 @@ sat_timems(unsigned int subtract) # if HAVE_QSORT_R || HAVE___QSORT_R void -sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) +solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) { # if HAVE_QSORT_R qsort_r(base, nmemb, size, compar, compard); @@ -124,38 +124,38 @@ sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, cons #else /* not glibc */ -struct sat_sort_data { +struct solv_sort_data { int (*compar)(const void *, const void *, void *); void *compard; }; static int -sat_sort_helper(void *compard, const void *a, const void *b) +solv_sort_helper(void *compard, const void *a, const void *b) { - struct sat_sort_data *d = compard; + struct solv_sort_data *d = compard; return (*d->compar)(a, b, d->compard); } void -sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) +solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) { - struct sat_sort_data d; + struct solv_sort_data d; d.compar = compar; d.compard = compard; - qsort_r(base, nmemb, size, &d, sat_sort_helper); + qsort_r(base, nmemb, size, &d, solv_sort_helper); } #endif char * -sat_dupjoin(const char *str1, const char *str2, const char *str3) +solv_dupjoin(const char *str1, const char *str2, const char *str3) { int l1, l2, l3; char *s, *str; l1 = str1 ? strlen(str1) : 0; l2 = str2 ? strlen(str2) : 0; l3 = str3 ? strlen(str3) : 0; - s = str = sat_malloc(l1 + l2 + l3 + 1); + s = str = solv_malloc(l1 + l2 + l3 + 1); if (l1) { strcpy(s, str1); @@ -176,15 +176,15 @@ sat_dupjoin(const char *str1, const char *str2, const char *str3) } char * -sat_dupappend(const char *str1, const char *str2, const char *str3) +solv_dupappend(const char *str1, const char *str2, const char *str3) { - char *str = sat_dupjoin(str1, str2, str3); - sat_free((void *)str1); + char *str = solv_dupjoin(str1, str2, str3); + solv_free((void *)str1); return str; } int -sat_hex2bin(const char **strp, unsigned char *buf, int bufl) +solv_hex2bin(const char **strp, unsigned char *buf, int bufl) { const char *str = *strp; int i; @@ -219,7 +219,7 @@ sat_hex2bin(const char **strp, unsigned char *buf, int bufl) } char * -sat_bin2hex(const unsigned char *buf, int l, char *str) +solv_bin2hex(const unsigned char *buf, int l, char *str) { int i; for (i = 0; i < l; i++, buf++) diff --git a/src/util.h b/src/util.h index f424ab9..41c82b9 100644 --- a/src/util.h +++ b/src/util.h @@ -20,32 +20,32 @@ * malloc * exits with error message on error */ -extern void *sat_malloc(size_t); -extern void *sat_malloc2(size_t, size_t); -extern void *sat_calloc(size_t, size_t); -extern void *sat_realloc(void *, size_t); -extern void *sat_realloc2(void *, size_t, size_t); -extern void *sat_free(void *); -extern void sat_oom(size_t, size_t); -extern unsigned int sat_timems(unsigned int subtract); -extern void sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard); -extern char *sat_dupjoin(const char *str1, const char *str2, const char *str3); -extern char *sat_dupappend(const char *str1, const char *str2, const char *str3); -extern int sat_hex2bin(const char **strp, unsigned char *buf, int bufl); -extern char *sat_bin2hex(const unsigned char *buf, int l, char *str); +extern void *solv_malloc(size_t); +extern void *solv_malloc2(size_t, size_t); +extern void *solv_calloc(size_t, size_t); +extern void *solv_realloc(void *, size_t); +extern void *solv_realloc2(void *, size_t, size_t); +extern void *solv_free(void *); +extern void solv_oom(size_t, size_t); +extern unsigned int solv_timems(unsigned int subtract); +extern void solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard); +extern char *solv_dupjoin(const char *str1, const char *str2, const char *str3); +extern char *solv_dupappend(const char *str1, const char *str2, const char *str3); +extern int solv_hex2bin(const char **strp, unsigned char *buf, int bufl); +extern char *solv_bin2hex(const unsigned char *buf, int l, char *str); -static inline void *sat_extend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) +static inline void *solv_extend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) { if (nmemb == 1) { if ((len & block) == 0) - buf = sat_realloc2(buf, len + (1 + block), size); + buf = solv_realloc2(buf, len + (1 + block), size); } else { if (((len - 1) | block) != ((len + nmemb - 1) | block)) - buf = sat_realloc2(buf, (len + (nmemb + block)) & ~block, size); + buf = solv_realloc2(buf, (len + (nmemb + block)) & ~block, size); } return buf; } @@ -58,26 +58,26 @@ static inline void *sat_extend(void *buf, size_t len, size_t nmemb, size_t size, * size size of each element * block block size used to allocate the elements */ -static inline void *sat_zextend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) +static inline void *solv_zextend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) { - buf = sat_extend(buf, len, nmemb, size, block); + buf = solv_extend(buf, len, nmemb, size, block); memset((char *)buf + len * size, 0, nmemb * size); return buf; } -static inline void *sat_extend_resize(void *buf, size_t len, size_t size, size_t block) +static inline void *solv_extend_resize(void *buf, size_t len, size_t size, size_t block) { if (len) - buf = sat_realloc2(buf, (len + block) & ~block, size); + buf = solv_realloc2(buf, (len + block) & ~block, size); return buf; } -static inline void *sat_calloc_block(size_t len, size_t size, size_t block) +static inline void *solv_calloc_block(size_t len, size_t size, size_t block) { void *buf; if (!len) return 0; - buf = sat_malloc2((len + block) & ~block, size); + buf = solv_malloc2((len + block) & ~block, size); memset(buf, 0, ((len + block) & ~block) * size); return buf; } diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f1aac86..d225d0d 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,5 @@ # -# CMakeLists.txt for sat-solver/tools +# CMakeLists.txt for tools # ADD_LIBRARY (toolstuff STATIC common_write.c) diff --git a/tools/common_write.c b/tools/common_write.c index 5f0fb01..7cd6783 100644 --- a/tools/common_write.c +++ b/tools/common_write.c @@ -186,7 +186,7 @@ write_info(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void for (i = 0; keyarray[i]; i++) repodata_add_idarray(info, h, REPOSITORY_KEYS, keyarray[i]); } - sat_free(keyarray); + solv_free(keyarray); repodata_set_str(info, h, REPOSITORY_LOCATION, location); repodata_add_flexarray(info, SOLVID_META, REPOSITORY_EXTERNAL, h); } @@ -213,7 +213,7 @@ tool_write(Repo *repo, const char *basename, const char *attrname) for (i = 0; addedfileprovides[i]; i++) repodata_add_idarray(info, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, addedfileprovides[i]); } - sat_free(addedfileprovides); + solv_free(addedfileprovides); pool_freeidhashes(repo->pool); /* free some mem */ @@ -247,7 +247,7 @@ tool_write(Repo *repo, const char *basename, const char *attrname) break; if (k < nlanguages) continue; - languages = sat_realloc2(languages, nlanguages + 1, sizeof(char *)); + languages = solv_realloc2(languages, nlanguages + 1, sizeof(char *)); languages[nlanguages++] = strdup(keyname + l); } } @@ -304,7 +304,7 @@ tool_write(Repo *repo, const char *basename, const char *attrname) fclose(fp); for (i = 0; i < nlanguages; i++) free(languages[i]); - sat_free(languages); + solv_free(languages); repodata_free(info); return 0; } diff --git a/tools/installcheck.c b/tools/installcheck.c index dc4d01d..e088aff 100644 --- a/tools/installcheck.c +++ b/tools/installcheck.c @@ -27,7 +27,7 @@ #include "repo_deb.h" #endif #include "solver.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" void @@ -97,7 +97,7 @@ main(int argc, char **argv) l = strlen(argv[i]); if (!strcmp(argv[i], "-")) fp = stdin; - else if ((fp = sat_xfopen(argv[i], 0)) == 0) + else if ((fp = solv_xfopen(argv[i], 0)) == 0) { perror(argv[i]); exit(1); diff --git a/tools/patchcheck.c b/tools/patchcheck.c index 4d170f8..28fa3f9 100644 --- a/tools/patchcheck.c +++ b/tools/patchcheck.c @@ -26,7 +26,7 @@ #include "solver.h" #include "solverdebug.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" void showproblems(Solver *solv, Solvable *s, Queue *cand, Queue *badguys) @@ -273,7 +273,7 @@ test_all_packages_installable(context_t *c, Id pid) queue_init(&job); - now = sat_timems(0); + now = solv_timems(0); solver_runs = 0; conp = s->repo->idarraydata + s->conflicts; @@ -334,7 +334,7 @@ test_all_packages_installable(context_t *c, Id pid) } if (PERF_DEBUGGING) - printf(" test_all_packages_installable took %d ms in %d runs\n", sat_timems(now), solver_runs); + printf(" test_all_packages_installable took %d ms in %d runs\n", solv_timems(now), solver_runs); } void @@ -354,7 +354,7 @@ test_can_upgrade_all_packages(context_t *c, Id pid) queue_init(&cand); queue_init(&badguys); - now = sat_timems(0); + now = solv_timems(0); solver_runs = 0; /* Test 3: can we upgrade all packages? */ @@ -441,7 +441,7 @@ test_can_upgrade_all_packages(context_t *c, Id pid) cand.count = j; } if (PERF_DEBUGGING) - printf(" test_can_upgrade_all_packages took %d ms in %d runs\n", sat_timems(now), solver_runs); + printf(" test_can_upgrade_all_packages took %d ms in %d runs\n", solv_timems(now), solver_runs); } void @@ -527,7 +527,7 @@ main(int argc, char **argv) l = strlen(argv[i]); if (!strcmp(argv[i], "-")) fp = stdin; - else if ((fp = sat_xfopen(argv[i], 0)) == 0) + else if ((fp = solv_xfopen(argv[i], 0)) == 0) { perror(argv[i]); exit(1); diff --git a/tools/repomdxml2solv.c b/tools/repomdxml2solv.c index e59716e..8e7eb0a 100644 --- a/tools/repomdxml2solv.c +++ b/tools/repomdxml2solv.c @@ -78,7 +78,7 @@ doquery(Pool *pool, Repo *repo, const char *query) case REPOKEY_TYPE_MD5: case REPOKEY_TYPE_SHA1: case REPOKEY_TYPE_SHA256: - printf("%s:%s\n", sat_chksum_type2str(di.key->type), repodata_chk2str(di.data, di.key->type, (unsigned char *)di.kv.str)); + printf("%s:%s\n", solv_chksum_type2str(di.key->type), repodata_chk2str(di.data, di.key->type, (unsigned char *)di.kv.str)); break; default: break; diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c index 515a8e7..85a9cc6 100644 --- a/tools/rpmdb2solv.c +++ b/tools/rpmdb2solv.c @@ -152,7 +152,7 @@ main(int argc, char **argv) int rootlen = strlen(root); if (strncmp(root, proddir, rootlen)) { - buf = (char *)sat_malloc(rootlen + strlen(proddir) + 2); /* + '/' + \0 */ + buf = (char *)solv_malloc(rootlen + strlen(proddir) + 2); /* + '/' + \0 */ strcpy(buf, root); if (root[rootlen - 1] != '/' && *proddir != '/') buf[rootlen++] = '/'; @@ -161,7 +161,7 @@ main(int argc, char **argv) } repo_add_products(repo, buf, root, REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE); if (buf != proddir) - sat_free(buf); + solv_free(buf); } repodata_internalize(data); diff --git a/tools/rpmmd2solv.c b/tools/rpmmd2solv.c index 18ec7ed..b1f9e3e 100644 --- a/tools/rpmmd2solv.c +++ b/tools/rpmmd2solv.c @@ -20,7 +20,7 @@ #include "repo.h" #include "repo_rpmmd.h" #include "common_write.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" static void @@ -78,9 +78,9 @@ main(int argc, char **argv) int l; char *fnp; l = strlen(dir) + 128; - fnp = sat_malloc(l+1); + fnp = solv_malloc(l+1); snprintf(fnp, l, "%s/primary.xml.gz", dir); - if (!(fp = sat_xfopen(fnp, 0))) + if (!(fp = solv_xfopen(fnp, 0))) { perror(fnp); exit(1); @@ -88,7 +88,7 @@ main(int argc, char **argv) repo_add_rpmmd(repo, fp, 0, flags); fclose(fp); snprintf(fnp, l, "%s/diskusagedata.xml.gz", dir); - if ((fp = sat_xfopen(fnp, 0))) + if ((fp = solv_xfopen(fnp, 0))) { repo_add_rpmmd(repo, fp, 0, flags); fclose(fp); @@ -100,7 +100,7 @@ main(int argc, char **argv) fprintf(stderr, "-l parameter too long\n"); exit(1); } - while (!(fp = sat_xfopen(fnp, 0))) + while (!(fp = solv_xfopen(fnp, 0))) { fprintf(stderr, "not opened %s\n", fnp); if (strlen(locale) > 2) @@ -110,7 +110,7 @@ main(int argc, char **argv) fprintf(stderr, "-l parameter too long\n"); exit(1); } - if ((fp = sat_xfopen(fnp, 0))) + if ((fp = solv_xfopen(fnp, 0))) break; } perror(fnp); @@ -120,7 +120,7 @@ main(int argc, char **argv) repo_add_rpmmd(repo, fp, 0, flags); fclose(fp); } - sat_free(fnp); + solv_free(fnp); } else repo_add_rpmmd(repo, stdin, 0, flags); diff --git a/tools/rpms2solv.c b/tools/rpms2solv.c index 76a659a..b1daec6 100644 --- a/tools/rpms2solv.c +++ b/tools/rpms2solv.c @@ -99,7 +99,7 @@ main(int argc, char **argv) if ((p = strchr(buf, '\n')) != 0) *p = 0; } - rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15); + rpms = solv_extend(rpms, nrpms, 1, sizeof(char *), 15); rpms[nrpms++] = strdup(buf); } if (fp != stdin) @@ -107,7 +107,7 @@ main(int argc, char **argv) } while (optind < argc) { - rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15); + rpms = solv_extend(rpms, nrpms, 1, sizeof(char *), 15); rpms[nrpms++] = strdup(argv[optind++]); } repo = repo_create(pool, "rpms2solv"); @@ -116,7 +116,7 @@ main(int argc, char **argv) pool_free(pool); for (c = 0; c < nrpms; c++) free((char *)rpms[c]); - sat_free(rpms); + solv_free(rpms); exit(0); } diff --git a/tools/susetags2solv.c b/tools/susetags2solv.c index b97d778..20a4b98 100644 --- a/tools/susetags2solv.c +++ b/tools/susetags2solv.c @@ -22,7 +22,7 @@ #include "repo_susetags.h" #include "repo_content.h" #include "common_write.h" -#include "sat_xfopen.h" +#include "solv_xfopen.h" static void usage(int status) @@ -163,7 +163,7 @@ main(int argc, char **argv) files[0] = de; } - fnp = sat_malloc(strlen(descrdir) + 128); + fnp = solv_malloc(strlen(descrdir) + 128); for (i = 0; i < ndirs; i++) { char *fn = files[i]->d_name; @@ -171,7 +171,7 @@ main(int argc, char **argv) if (!strcmp(fn, "packages") || !strcmp(fn, "packages.gz")) { sprintf(fnp, "%s/%s", descrdir, fn); - FILE *fp = sat_xfopen(fnp, 0); + FILE *fp = solv_xfopen(fnp, 0); if (!fp) { perror(fn); @@ -183,7 +183,7 @@ main(int argc, char **argv) else if (!strcmp(fn, "packages.DU") || !strcmp(fn, "packages.DU.gz")) { sprintf(fnp, "%s/%s", descrdir, fn); - FILE *fp = sat_xfopen(fnp, 0); + FILE *fp = solv_xfopen(fnp, 0); if (!fp) { perror(fn); @@ -196,7 +196,7 @@ main(int argc, char **argv) { #if 0 sprintf(fnp, "%s/%s", descrdir, fn); - FILE *fp = sat_xfopen(fnp, 0); + FILE *fp = solv_xfopen(fnp, 0); if (!fp) { perror(fn); @@ -224,7 +224,7 @@ main(int argc, char **argv) continue; strcpy(lang, p + 1); sprintf(fnp, "%s/%s", descrdir, fn); - FILE *fp = sat_xfopen(fnp, 0); + FILE *fp = solv_xfopen(fnp, 0); if (!fp) { perror(fn); -- 2.7.4