From: Michael Schroeder Date: Fri, 23 Aug 2013 14:42:21 +0000 (+0200) Subject: add forgotten repo/repodata_lookup_binary X-Git-Tag: upstream/0.4.0~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6570f2aa0ea0527e2adfad2c69044f7116b55e6;p=platform%2Fupstream%2Flibsolv.git add forgotten repo/repodata_lookup_binary --- diff --git a/src/libsolv.ver b/src/libsolv.ver index eec2018..b2d2ca6 100644 --- a/src/libsolv.ver +++ b/src/libsolv.ver @@ -151,6 +151,7 @@ SOLV_1.0 { repo_internalize; repo_last_repodata; repo_lookup_bin_checksum; + repo_lookup_binary; repo_lookup_checksum; repo_lookup_deparray; repo_lookup_id; @@ -196,6 +197,7 @@ SOLV_1.0 { repodata_key2id; repodata_localize_id; repodata_lookup_bin_checksum; + repodata_lookup_binary; repodata_lookup_id; repodata_lookup_id_uninternalized; repodata_lookup_idarray; diff --git a/src/repo.c b/src/repo.c index 3b8ef62..a6caa4b 100644 --- a/src/repo.c +++ b/src/repo.c @@ -1419,6 +1419,30 @@ repo_lookup_type(Repo *repo, Id entry, Id keyname) return 0; } +const void * +repo_lookup_binary(Repo *repo, Id entry, Id keyname, int *lenp) +{ + Pool *pool = repo->pool; + Repodata *data; + int i; + const void *bin; + + if (entry == SOLVID_POS && pool->pos.repo == repo && pool->pos.repodataid) + return repodata_lookup_binary(pool->pos.repo->repodata + pool->pos.repodataid, entry, keyname, lenp); + FOR_REPODATAS(repo, i, data) + { + if (entry != SOLVID_META && (entry < data->start || entry >= data->end)) + continue; + if (!repodata_precheck_keyname(data, keyname)) + continue; + bin = repodata_lookup_binary(data, entry, keyname, lenp); + if (bin) + return bin; + } + *lenp = 0; + return 0; +} + /***********************************************************************/ Repodata * @@ -1773,6 +1797,3 @@ repo_disable_paging(Repo *repo) repodata_disable_paging(data); } -/* -vim:cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s:tw=78:cindent:sw=4: -*/ diff --git a/src/repo.h b/src/repo.h index ad27449..5010b5d 100644 --- a/src/repo.h +++ b/src/repo.h @@ -149,6 +149,7 @@ int repo_lookup_deparray(Repo *repo, Id entry, Id keyname, Queue *q, Id marker); int repo_lookup_void(Repo *repo, Id entry, Id keyname); const char *repo_lookup_checksum(Repo *repo, Id entry, Id keyname, Id *typep); const unsigned char *repo_lookup_bin_checksum(Repo *repo, Id entry, Id keyname, Id *typep); +const void *repo_lookup_binary(Repo *repo, Id entry, Id keyname, int *lenp); void repo_set_id(Repo *repo, Id p, Id keyname, Id id); void repo_set_num(Repo *repo, Id p, Id keyname, unsigned long long num); diff --git a/src/repodata.c b/src/repodata.c index 1fdbc0e..6b02b9f 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -769,6 +769,24 @@ repodata_lookup_idarray(Repodata *data, Id solvid, Id keyname, Queue *q) return 1; } +const void * +repodata_lookup_binary(Repodata *data, Id solvid, Id keyname, int *lenp) +{ + unsigned char *dp; + Repokey *key; + Id len; + + dp = find_key_data(data, solvid, keyname, &key); + if (!dp || key->type != REPOKEY_TYPE_BINARY) + { + *lenp = 0; + return 0; + } + dp = data_read_id(dp, &len); + *lenp = len; + return dp; +} + Id repodata_globalize_id(Repodata *data, Id id, int create) { @@ -3404,6 +3422,3 @@ repodata_memused(Repodata *data) return data->incoredatalen + data->vincorelen; } -/* -vim:cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s:tw=78:cindent:sw=4: -*/ diff --git a/src/repodata.h b/src/repodata.h index 3b3eb19..bdd4b4a 100644 --- a/src/repodata.h +++ b/src/repodata.h @@ -210,6 +210,7 @@ int repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned long lon int repodata_lookup_void(Repodata *data, Id solvid, Id keyname); const unsigned char *repodata_lookup_bin_checksum(Repodata *data, Id solvid, Id keyname, Id *typep); int repodata_lookup_idarray(Repodata *data, Id solvid, Id keyname, Queue *q); +const void *repodata_lookup_binary(Repodata *data, Id solvid, Id keyname, int *lenp); /*-----