From: Michael Schroeder Date: Tue, 9 Apr 2019 09:13:17 +0000 (+0200) Subject: Allow to lookup a single id with repodata_lookup_idarray X-Git-Tag: 0.7.5~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cbb203417f6828c45da0b7ad2268ba832c1d84d;p=thirdparty%2Flibsolv.git Allow to lookup a single id with repodata_lookup_idarray I don't see any harm in allowing this and it makes dealing with things like SOLVABLE_LICENSE easier which can be either an id (the old way) or an id array (the new way). --- diff --git a/src/repodata.c b/src/repodata.c index ad5aaea3..54d5bb23 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -791,14 +791,28 @@ repodata_lookup_idarray(Repodata *data, Id solvid, Id keyname, Queue *q) queue_empty(q); dp = find_key_data(data, solvid, keyname, &key); - if (!dp || key->type != REPOKEY_TYPE_IDARRAY) + if (!dp) return 0; - for (;;) + switch (key->type) { - dp = data_read_ideof(dp, &id, &eof); + case REPOKEY_TYPE_CONSTANTID: + queue_push(q, key->size); + break; + case REPOKEY_TYPE_ID: + dp = data_read_id(dp, &id); queue_push(q, id); - if (eof) - break; + break; + case REPOKEY_TYPE_IDARRAY: + for (;;) + { + dp = data_read_ideof(dp, &id, &eof); + queue_push(q, id); + if (eof) + break; + } + break; + default: + return 0; } return 1; }