commit 88e8dc5: [Minor] Add method to get count of the headers
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Oct 14 20:35:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-10-14 15:15:36 +0100
URL: https://github.com/rspamd/rspamd/commit/88e8dc5fcb2a501728c0558501ed2345aff7a94f
[Minor] Add method to get count of the headers
---
src/libmime/mime_headers.c | 10 ++++++++++
src/libmime/mime_headers.h | 7 +++++++
2 files changed, 17 insertions(+)
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index 88675a629..3deb26a08 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -948,6 +948,16 @@ rspamd_message_get_header_array (struct rspamd_task *task, const gchar *field,
field, need_modified);
}
+gsize
+rspamd_mime_headers_count (struct rspamd_mime_headers_table *hdrs)
+{
+ if (hdrs) {
+ return kh_size (&hdrs->htb);
+ }
+
+ return 0;
+}
+
static void
rspamd_message_headers_dtor (struct rspamd_mime_headers_table *hdrs)
{
diff --git a/src/libmime/mime_headers.h b/src/libmime/mime_headers.h
index 07a64c31e..7174f9e8f 100644
--- a/src/libmime/mime_headers.h
+++ b/src/libmime/mime_headers.h
@@ -160,6 +160,13 @@ struct rspamd_mime_headers_table * rspamd_message_headers_ref (struct rspamd_mim
*/
struct rspamd_mime_headers_table* rspamd_message_headers_new (void);
+/**
+ * Returns size for a headers table
+ * @param hdrs
+ * @return
+ */
+gsize rspamd_mime_headers_count (struct rspamd_mime_headers_table *hdrs);
+
/**
* Strip rfc822 CFWS sequences from a string in place
* @param input input
More information about the Commits
mailing list