mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
g10: Use accessors for expiration dates of public keys.
* g10/Makefile.am (common_source): Add new file. * g10/packet-functions.h: New file. * g10/packet.h (PKT_public_key): New flag 'valid_expiredate'. * g10/call-dirmngr.c: Apply the following semantic patch. * g10/free-packet.c: Likewise. * g10/getkey.c: Likewise. * g10/keyedit.c: Likewise. * g10/keygen.c: Likewise. Here with small manual fixups. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/mainproc.c: Likewise. * g10/parse-packet.c: Likewise. * g10/pubkey-enc.c: Likewise. * g10/sig-check.c: Likewise. * g10/trustdb.c: Likewise. -- @@ PKT_public_key *E; expression X; @@ -E->expiredate = X +kb_pk_set_expiredate (E, X) @@ PKT_public_key *E; @@ -E->expiredate +kb_pk_expiredate (E) Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
a1a64820c3
commit
65c8002b70
15 changed files with 93 additions and 40 deletions
49
g10/packet-functions.h
Normal file
49
g10/packet-functions.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* packet-functions.h - Accessor functions for in-core representations.
|
||||
* Copyright (C) 2017 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef G10_PACKET_FUNCTIONS_H
|
||||
#define G10_PACKET_FUNCTIONS_H
|
||||
|
||||
#include "../common/logging.h"
|
||||
|
||||
static inline u32
|
||||
kb_pk_set_expiredate (PKT_public_key *pk, u32 value)
|
||||
{
|
||||
pk->expiredate = value;
|
||||
pk->flags.valid_expiredate = 1;
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void
|
||||
kb_pk_invalidate_expiredate (PKT_public_key *pk)
|
||||
{
|
||||
pk->expiredate = 0;
|
||||
pk->flags.valid_expiredate = 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
kb_pk_valid_expiredate (PKT_public_key *pk)
|
||||
{
|
||||
return pk->flags.valid_expiredate;
|
||||
}
|
||||
|
||||
#define kb_pk_expiredate(PK) \
|
||||
(log_assert ((PK)->flags.valid_expiredate), (PK)->expiredate)
|
||||
|
||||
#endif /*G10_PACKET_FUNCTIONS_H*/
|
Loading…
Add table
Add a link
Reference in a new issue