@@ -35,7 +35,6 @@ struct arg;
3535void vars_init_head (struct vars * vars , enum vars_scope scope );
3636void var_accounting_diff (struct vars * vars , struct session * sess , struct stream * strm , int size );
3737unsigned int var_clear (struct var * var , int force );
38- void vars_prune (struct vars * vars , struct session * sess , struct stream * strm );
3938void vars_prune_per_sess (struct vars * vars );
4039int var_set (const struct var_desc * desc , struct sample * smp , uint flags );
4140int var_unset (const struct var_desc * desc , struct sample * smp );
@@ -74,4 +73,19 @@ static inline void vars_rdunlock(struct vars *vars)
7473 HA_RWLOCK_RDUNLOCK (VARS_LOCK , & vars -> rwlock );
7574}
7675
76+ /* This function free all the memory used by all the variables
77+ * in the list.
78+ */
79+ static inline void vars_prune (struct vars * vars , struct session * sess , struct stream * strm )
80+ {
81+ struct var * var , * tmp ;
82+ unsigned int size = 0 ;
83+
84+ list_for_each_entry_safe (var , tmp , & vars -> head , l ) {
85+ size += var_clear (var , 1 );
86+ }
87+
88+ var_accounting_diff (vars , sess , strm , - size );
89+ }
90+
7791#endif
0 commit comments