From 243c905356e36f9b05b11ad72771f63196250e7a Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Fri, 24 Aug 2012 21:52:20 -0700 Subject: [PATCH 1/1] Move stats_key structure to stats.h It still ends up pulled into the core objects by mem.c / hash.c, but we no longer pollute keystructs.h --- hash.c | 1 + hash.h | 1 + keystructs.h | 22 ---------------------- mem.c | 1 + mem.h | 1 + stats.h | 23 ++++++++++++++++++++++- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/hash.c b/hash.c index 49443ed..506bd4c 100644 --- a/hash.c +++ b/hash.c @@ -25,6 +25,7 @@ #include "keystructs.h" #include "ll.h" #include "mem.h" +#include "stats.h" /** * hashtable - the hash table array. diff --git a/hash.h b/hash.h index 9d7578d..161fcf5 100644 --- a/hash.h +++ b/hash.h @@ -22,6 +22,7 @@ #include "keystructs.h" #include "ll.h" +#include "stats.h" #define HASHSIZE 1024 #define HASHMASK 0x3FF diff --git a/keystructs.h b/keystructs.h index efa9a99..fcfed12 100644 --- a/keystructs.h +++ b/keystructs.h @@ -99,28 +99,6 @@ struct openpgp_publickey { struct openpgp_publickey *next; }; -/** - * @brief Holds key details suitable for doing stats on. - */ -struct stats_key { - /** The keyid. */ - uint64_t keyid; - /** Used for marking during DFS/BFS. */ - int colour; - /** The key that lead us to this one for DFS/BFS. */ - uint64_t parent; - /** A linked list of the signatures on this key. */ - struct ll *sigs; - /** A linked list of the keys this key signs. */ - struct ll *signs; - /** A bool indicating if we've initialized the sigs element yet. */ - bool gotsigs; - /** If we shouldn't consider the key in calculations. */ - bool disabled; - /** If the key is revoked (and shouldn't be considered). */ - bool revoked; -}; - /** * @brief Holds an SKS key hash (md5 over sorted packet list) */ diff --git a/mem.c b/mem.c index 2b45158..83c6384 100644 --- a/mem.c +++ b/mem.c @@ -24,6 +24,7 @@ #include "keystructs.h" #include "ll.h" #include "mem.h" +#include "stats.h" /** * packet_dup - duplicate an OpenPGP packet. diff --git a/mem.h b/mem.h index de93567..be24e20 100644 --- a/mem.h +++ b/mem.h @@ -21,6 +21,7 @@ #define __MEM_H_ #include "keystructs.h" +#include "stats.h" /** * packet_dup - duplicate an OpenPGP packet. diff --git a/stats.h b/stats.h index 19637eb..08e2abe 100644 --- a/stats.h +++ b/stats.h @@ -33,9 +33,30 @@ key_getsigns - get the keys a key signs. */ #include #include -#include "keystructs.h" #include "ll.h" +/** + * @brief Holds key details suitable for doing stats on. + */ +struct stats_key { + /** The keyid. */ + uint64_t keyid; + /** Used for marking during DFS/BFS. */ + int colour; + /** The key that lead us to this one for DFS/BFS. */ + uint64_t parent; + /** A linked list of the signatures on this key. */ + struct ll *sigs; + /** A linked list of the keys this key signs. */ + struct ll *signs; + /** A bool indicating if we've initialized the sigs element yet. */ + bool gotsigs; + /** If we shouldn't consider the key in calculations. */ + bool disabled; + /** If the key is revoked (and shouldn't be considered). */ + bool revoked; +}; + /** * initcolour - Clear the key graph ready for use. * @parent: Do we want to clear the parent pointers too? -- 2.39.5