Skip to content

Commit

Permalink
Add rpmKeyringIsEmpty()
Browse files Browse the repository at this point in the history
This will become handy later
  • Loading branch information
ffesti committed Dec 13, 2024
1 parent c162388 commit fc89966
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/rpm/rpmkeyring.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ rpmKeyring rpmKeyringNew(void);
*/
rpmKeyring rpmKeyringFree(rpmKeyring keyring);

/** \ingroup rpmkeyring
* Check if there are no keys in the keyring.
* @param keyring keyring handle
* @return 1 if keyring is empy, 0 otherwise
*/
int rpmKeyringIsEmpty(rpmKeyring keyring);

/** \ingroup rpmkeyring
* Add a public key to keyring.
* @param keyring keyring handle
Expand Down
8 changes: 8 additions & 0 deletions rpmio/rpmkeyring.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ rpmKeyring rpmKeyringFree(rpmKeyring keyring)
return NULL;
}

int rpmKeyringIsEmpty(rpmKeyring keyring)
{
if (!keyring) return 1;
rdlock lock(keyring->mutex);
return keyring->keys.empty();
}


rpmKeyringIterator rpmKeyringInitIterator(rpmKeyring keyring, int unused)
{
if (!keyring || unused != 0)
Expand Down

0 comments on commit fc89966

Please sign in to comment.