commit f3b23bc: [Minor] Save 8 bytes in rspamd_regexp_t

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Aug 24 15:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-08-24 16:30:34 +0100
URL: https://github.com/rspamd/rspamd/commit/f3b23bccaf6cac71aa3ca25279184d3f48a2e68a (HEAD -> master)

[Minor] Save 8 bytes in rspamd_regexp_t

---
 src/libutil/regexp.c | 29 -----------------------------
 src/libutil/regexp.h | 10 ----------
 2 files changed, 39 deletions(-)

diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 46ed9a0df..90920a95e 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -71,7 +71,6 @@ struct rspamd_regexp_s {
 	gint flags;
 	gint pcre_flags;
 	gint ncaptures;
-	gint nbackref;
 };
 
 struct rspamd_regexp_cache {
@@ -516,24 +515,12 @@ fin:
 			&ncaptures) == 0) {
 		res->ncaptures = ncaptures;
 	}
-
-	/* Check number of backrefs */
-	if (pcre_fullinfo (res->raw_re, res->extra, PCRE_INFO_BACKREFMAX,
-			&ncaptures) == 0) {
-		res->nbackref = ncaptures;
-	}
 #else
 	/* Check number of captures */
 	if (pcre2_pattern_info (res->raw_re, PCRE2_INFO_CAPTURECOUNT,
 			&ncaptures) == 0) {
 		res->ncaptures = ncaptures;
 	}
-
-	/* Check number of backrefs */
-	if (pcre2_pattern_info (res->raw_re, PCRE2_INFO_BACKREFMAX,
-			&ncaptures) == 0) {
-		res->nbackref = ncaptures;
-	}
 #endif
 
 	return res;
@@ -838,22 +825,6 @@ rspamd_regexp_get_pcre_flags (const rspamd_regexp_t *re)
 	return re->pcre_flags;
 }
 
-gint
-rspamd_regexp_get_nbackrefs (const rspamd_regexp_t *re)
-{
-	g_assert (re != NULL);
-
-	return re->nbackref;
-}
-
-gint
-rspamd_regexp_get_ncaptures (const rspamd_regexp_t *re)
-{
-	g_assert (re != NULL);
-
-	return re->ncaptures;
-}
-
 guint
 rspamd_regexp_get_maxhits (const rspamd_regexp_t *re)
 {
diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h
index 3437619d1..239df03b4 100644
--- a/src/libutil/regexp.h
+++ b/src/libutil/regexp.h
@@ -161,16 +161,6 @@ guint rspamd_regexp_get_maxhits (const rspamd_regexp_t *re);
  */
 guint rspamd_regexp_set_maxhits (rspamd_regexp_t *re, guint new_maxhits);
 
-/**
- * Returns number of backreferences in a regexp
- */
-gint rspamd_regexp_get_nbackrefs (const rspamd_regexp_t *re);
-
-/**
- * Returns number of capture groups in a regexp
- */
-gint rspamd_regexp_get_ncaptures (const rspamd_regexp_t *re);
-
 /**
  * Returns cache id for a regexp
  */


More information about the Commits mailing list