@@ -107,12 +107,10 @@ static struct {
107107 */
108108 int pass ;
109109/*
110- * Some rule commands may temporarily double the length, and we skip a few
111- * machine words to avoid cache bank conflicts when copying data between the
112- * buffers. We need three buffers because some rule commands require separate
113- * input and output buffers and we also need a buffer either for leaving the
114- * previous mangled word intact for a subsequent comparison (in wordlist mode)
115- * or for switching between two input words (in "single crack" mode).
110+ * Some rule commands may temporarily double the length.
111+ * We need three buffers because some rule commands require separate input and
112+ * output buffers and we also need a buffer for switching between two input
113+ * words in "single crack" mode.
116114 * rules_apply() tries to minimize data copying, and thus it may return a
117115 * pointer to any of the three buffers.
118116 *
@@ -576,7 +574,7 @@ int rules_init_stack(char *ruleset, rule_stack *stack_ctx,
576574 do {
577575 rule_number ++ ;
578576
579- if ((rule = rules_reject (prerule , -1 , NULL , db ))) {
577+ if ((rule = rules_reject (prerule , -1 , db ))) {
580578 list_add (stack_ctx -> stack_rule , rule );
581579 active_rules ++ ;
582580
@@ -642,7 +640,7 @@ void rules_init(struct db_main *db, int max_length)
642640 rules_stacked_after = (options .flags & (FLG_RULES_CHK | FLG_SINGLE_CHK | FLG_BATCH_CHK )) && (options .flags & FLG_RULES_STACK_CHK );
643641}
644642
645- char * rules_reject (char * rule , int split , char * last , struct db_main * db )
643+ char * rules_reject (char * rule , int split , struct db_main * db )
646644{
647645 static char out_rule [RULE_BUFFER_SIZE ];
648646
@@ -748,15 +746,15 @@ char *rules_reject(char *rule, int split, char *last, struct db_main *db)
748746accept :
749747 rules_pass -- ;
750748 strnzcpy (out_rule , rule - 1 , sizeof (out_rule ));
751- rules_apply (safe_null_string , out_rule , split , last );
749+ rules_apply (safe_null_string , out_rule , split );
752750 rules_pass ++ ;
753751
754752 return out_rule ;
755753}
756754
757755#define STACK_MAXLEN (rules_stacked_after ? RULE_WORD_SIZE : rules_max_length)
758756
759- char * rules_apply (char * word_in , char * rule , int split , char * last )
757+ char * rules_apply (char * word_in , char * rule , int split )
760758{
761759 union {
762760 char aligned [PLAINTEXT_BUFFER_SIZE ];
@@ -776,8 +774,6 @@ char *rules_apply(char *word_in, char *rule, int split, char *last)
776774 memory = word = word_in ;
777775
778776 in = buffer [0 ][STAGE ];
779- if (in == last )
780- in = buffer [2 ][STAGE ];
781777
782778 length = 0 ;
783779 while (length < RULE_WORD_SIZE ) {
@@ -797,8 +793,6 @@ char *rules_apply(char *word_in, char *rule, int split, char *last)
797793 REJECT
798794
799795 alt = buffer [1 ][STAGE ];
800- if (alt == last )
801- alt = buffer [2 ][STAGE ];
802796
803797/*
804798 * This assumes that RULE_WORD_SIZE is small enough that length can't reach or
@@ -1771,22 +1765,6 @@ char *rules_apply(char *word_in, char *rule, int split, char *last)
17711765 length = strlen (in );
17721766 }
17731767
1774- if (last ) {
1775- if (length > STACK_MAXLEN )
1776- length = STACK_MAXLEN ;
1777- if (length >= ARCH_SIZE - 1 ) {
1778- if (* (ARCH_WORD * )in != * (ARCH_WORD * )last )
1779- return in ;
1780- if (strcmp (& in [ARCH_SIZE - 1 ], & last [ARCH_SIZE - 1 ]))
1781- return in ;
1782- return NULL ;
1783- }
1784- if (last [length ])
1785- return in ;
1786- if (memcmp (in , last , length ))
1787- return in ;
1788- return NULL ;
1789- }
17901768 return in ;
17911769
17921770out_which :
@@ -1849,11 +1827,6 @@ int rules_advance_stack(rule_stack *ctx, int quiet)
18491827 */
18501828char * rules_process_stack (char * key , rule_stack * ctx )
18511829{
1852- static union {
1853- char buf [LINE_BUFFER_SIZE ];
1854- ARCH_WORD dummy ;
1855- } aligned ;
1856- static char * last = aligned .buf ;
18571830 char * word ;
18581831
18591832 if (!ctx -> rule ) {
@@ -1865,8 +1838,7 @@ char *rules_process_stack(char *key, rule_stack *ctx)
18651838
18661839 rules_stacked_after = 0 ;
18671840
1868- if ((word = rules_apply (key , ctx -> rule -> data , -1 , last )))
1869- last = word ;
1841+ word = rules_apply (key , ctx -> rule -> data , -1 );
18701842
18711843 rules_stacked_after = !!(options .flags & (FLG_RULES_CHK | FLG_SINGLE_CHK | FLG_BATCH_CHK ));
18721844
@@ -1878,11 +1850,6 @@ char *rules_process_stack(char *key, rule_stack *ctx)
18781850 */
18791851char * rules_process_stack_all (char * key , rule_stack * ctx )
18801852{
1881- static union {
1882- char buf [LINE_BUFFER_SIZE ];
1883- ARCH_WORD dummy ;
1884- } aligned ;
1885- static char * last = aligned .buf ;
18861853 char * word ;
18871854
18881855 if (!ctx -> rule ) {
@@ -1896,10 +1863,8 @@ char *rules_process_stack_all(char *key, rule_stack *ctx)
18961863 rules_stacked_after = 0 ;
18971864
18981865 while (ctx -> rule ) {
1899- if ((word = rules_apply (key , ctx -> rule -> data , -1 , last ))) {
1900- last = word ;
1866+ if ((word = rules_apply (key , ctx -> rule -> data , -1 )))
19011867 return word ;
1902- } else
19031868 if ((ctx -> rule = ctx -> rule -> next )) {
19041869 rules_stacked_number ++ ;
19051870 if (!stack_rules_mute )
@@ -1943,7 +1908,7 @@ static int rules_check(struct rpp_context *start, int split)
19431908
19441909 rules_pass = -1 ; /* rules_reject() will turn this into -2 */
19451910 while ((rule = rpp_next (& ctx ))) {
1946- rules_reject (rule , split , NULL , NULL );
1911+ rules_reject (rule , split , NULL );
19471912 if (rules_errno ) break ;
19481913
19491914 if (ctx .input ) rules_line = ctx .input -> number ;
@@ -1981,7 +1946,7 @@ static void rules_load_normalized_list(struct cfg_line *pLine)
19811946 /*
19821947 * this will 'reduce' the rule by stripping no-op's.
19831948 */
1984- char * rule = rules_reject (pLine -> data , -1 , NULL , NULL );
1949+ char * rule = rules_reject (pLine -> data , -1 , NULL );
19851950 if (rule ) {
19861951 rules_normalize_add_line (rule , pLine -> id );
19871952 ++ rules_tmp_dup_removal_cnt ;
0 commit comments