>From 12205cd3c6b795beab8d4293be0ab70eaa290cc9 Mon Sep 17 00:00:00 2001 From: magnum Date: Thu, 4 Aug 2011 01:33:16 +0200 Subject: [PATCH] get rid of dupe variable in wordlist.c --- src/wordlist.c | 42 ++---------------------------------------- 1 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/wordlist.c b/src/wordlist.c index f49addf..33f0c30 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -53,11 +53,7 @@ static struct rpp_context *rule_ctx; // used for file in 'memory map' mode static char *word_file_str, **words; -#ifdef HAVE_MPI static unsigned int nWordFileLines; -#else -static unsigned int nWordFileLines = 0, nCurLine; -#endif static struct db_main *_db; @@ -100,25 +96,17 @@ static int restore_state(FILE *file) restore_line_number(); else { if (nWordFileLines) { -#ifdef HAVE_MPI for (line_number = 0; line_number < nWordFileLines; ++line_number) { if (words[line_number] - words[0] >= rec_pos) -#else - for (nCurLine = 0; nCurLine < nWordFileLines; ++nCurLine) { - if (words[nCurLine] - words[0] >= rec_pos) -#endif break; } } -#ifdef HAVE_MPI else { if (fseek(word_file, rec_pos, SEEK_SET)) pexit("fseek"); +#ifdef HAVE_MPI line_number = rec_pos ? mpi_id : 0; // we just need the correct modulus - } -#else - else - if (fseek(word_file, rec_pos, SEEK_SET)) pexit("fseek"); #endif + } } return 0; @@ -130,11 +118,7 @@ static void fix_state(void) { if (nWordFileLines) { rec_rule = rule_number; -#ifdef HAVE_MPI rec_pos = words[line_number] - words[0]; -#else - rec_pos = words[nCurLine] - words[0]; -#endif return; } @@ -375,11 +359,7 @@ void do_wordlist_crack(struct db_main *db, char *name, int rules) if (ec == '\r' && *cp == '\n') cp++; } while (cp < aep); nWordFileLines = i; -#ifdef HAVE_MPI line_number = 0; -#else - nCurLine=0; -#endif } } else { /* Ok, we can be in --stdin or --pipe mode. In --stdin, we simply copy over the @@ -546,28 +526,16 @@ GRAB_NEXT_PIPE_LOAD:; if (rule) while (1) { if (nWordFileLines) { -#ifdef HAVE_MPI if (line_number == nWordFileLines) -#else - if (nCurLine == nWordFileLines) -#endif break; #ifdef HAVE_MPI if (!distributeWords || line_number % mpi_p == mpi_id) #endif #if 0 && ARCH_ALLOWS_UNALIGNED /* XXX: somehow this breaks things - why? */ -#ifdef HAVE_MPI line = words[line_number]; -#else /* HAVE_MPI */ - line = words[nCurLine++]; -#endif /* HAVE_MPI */ #else /* 0 && ARCH_ALLOWS_UNALIGNED */ -#ifdef HAVE_MPI strcpy(line, words[line_number]); -#else /* HAVE_MPI */ - strcpy(line, words[nCurLine++]); -#endif /* HAVE_MPI */ #endif /* 0 && ARCH_ALLOWS_UNALIGNED */ } else { @@ -606,13 +574,7 @@ not_comment: line_number = 0; -#ifdef HAVE_MPI if (!nWordFileLines) -#else - if (nWordFileLines) - nCurLine = 0; - else -#endif if (fseek(word_file, 0, SEEK_SET)) pexit("fseek"); } } while (rules); -- 1.7.4.1