rename repo_find_pubkeys to repo_find_all_pubkeys, add repo_find_pubkey
authorMichael Schroeder <mls@suse.de>
Mon, 18 Nov 2013 13:47:43 +0000 (14:47 +0100)
committerMichael Schroeder <mls@suse.de>
Mon, 18 Nov 2013 13:47:43 +0000 (14:47 +0100)
bindings/solv.i
ext/libsolvext.ver
ext/repo_pubkey.c
ext/repo_pubkey.h

index da032a9..bfda714 100644 (file)
@@ -1632,13 +1632,7 @@ rb_eval_string(
 #ifdef ENABLE_PUBKEY
   %newobject find_pubkey;
   XSolvable *find_pubkey(const char *keyid) {
-    Queue q;
-    Id p;
-    queue_init(&q);
-    repo_find_pubkeys($self, keyid, &q);
-    p = q.count ? q.elements[0] : 0;
-    queue_free(&q);
-    return new_XSolvable($self->pool, p);
+    return new_XSolvable($self->pool, repo_find_pubkey($self, keyid));
   }
 #endif
 
index edede2a..5c176e2 100644 (file)
@@ -37,7 +37,8 @@ SOLV_1.0 {
                repo_add_susetags;
                repo_add_updateinfoxml;
                repo_add_zyppdb_products;
-               repo_find_pubkeys;
+               repo_find_all_pubkeys;
+               repo_find_pubkey;
                repo_verify_sigdata;
                rpm_byfp;
                rpm_byrpmdbid;
index 50066cc..f389283 100644 (file)
@@ -1148,7 +1148,7 @@ solvsig_free(Solvsig *ss)
 }
 
 static int
-repo_find_pubkeys_cmp(const void *va, const void *vb, void *dp)
+repo_find_all_pubkeys_cmp(const void *va, const void *vb, void *dp)
 {
   Pool *pool = dp;
   Id a = *(Id *)va;
@@ -1158,7 +1158,7 @@ repo_find_pubkeys_cmp(const void *va, const void *vb, void *dp)
 }
 
 void
-repo_find_pubkeys(Repo *repo, const char *keyid, Queue *q)
+repo_find_all_pubkeys(Repo *repo, const char *keyid, Queue *q)
 {
   Id p;
   Solvable *s;
@@ -1178,7 +1178,19 @@ repo_find_pubkeys(Repo *repo, const char *keyid, Queue *q)
         queue_push(q, p);
     }
   if (q->count > 1)
-    solv_sort(q->elements, q->count, sizeof(Id), repo_find_pubkeys_cmp, repo->pool);
+    solv_sort(q->elements, q->count, sizeof(Id), repo_find_all_pubkeys_cmp, repo->pool);
+}
+
+Id
+repo_find_pubkey(Repo *repo, const char *keyid)
+{
+  Queue q;
+  Id p;
+  queue_init(&q);
+  repo_find_all_pubkeys(repo, keyid, &q);
+  p = q.count ? q.elements[0] : 0;
+  queue_free(&q);
+  return p;
 }
 
 #ifdef ENABLE_PGPVRFY
@@ -1195,7 +1207,7 @@ repo_verify_sigdata(Repo *repo, unsigned char *sigdata, int sigdatal, const char
   if (!sigdata || !keyid)
     return 0;
   queue_init(&q);
-  repo_find_pubkeys(repo, keyid, &q);
+  repo_find_all_pubkeys(repo, keyid, &q);
   for (i = 0; i < q.count; i++)
     {
       int pubdatal;
index cfe9def..dbc7f9c 100644 (file)
@@ -33,5 +33,6 @@ void solvsig_free(Solvsig *ss);
 Id solvsig_verify(Solvsig *ss, Repo *repo, Chksum *chk);
 
 Id repo_verify_sigdata(Repo *repo, unsigned char *sigdata, int sigdatal, const char *keyid);
-void repo_find_pubkeys(Repo *repo, const char *keyid, Queue *q);
+Id repo_find_pubkey(Repo *repo, const char *keyid);
+void repo_find_all_pubkeys(Repo *repo, const char *keyid, Queue *q);