Skip to content

Commit

Permalink
Fixes for generic build
Browse files Browse the repository at this point in the history
  • Loading branch information
magnumripper authored and solardiz committed May 20, 2022
1 parent 351fb51 commit 77f0cee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ char *benchmark_format(struct fmt_main *format, int salts,
#ifdef BENCH_BUILD
const char *where;
if ((where = fmt_self_test(format, test_db))) {
static char s_error[128];
snprintf(s_error, sizeof(s_error), "FAILED (%s)\n", where);
return s_error;
}
Expand Down Expand Up @@ -676,7 +677,6 @@ void gather_results(struct bench_results *results)
int benchmark_all(void)
{
struct fmt_main *format;
int i;
#if defined(HAVE_OPENCL)
char s_gpu[16 * MAX_GPU_DEVICES] = "";
char s_gpu1[16 * MAX_GPU_DEVICES] = "";
Expand All @@ -685,6 +685,7 @@ int benchmark_all(void)
const char *s_gpu1 = "";
#endif
#ifndef BENCH_BUILD
int i;
unsigned int loop_fail = 0, loop_total = 1;
int nvidia_mem = 0;
#endif
Expand Down Expand Up @@ -799,7 +800,7 @@ int benchmark_all(void)
#if defined(HAVE_OPENCL) || defined(HAVE_ZTEX)
int using_int_mask = (format->params.flags & FMT_MASK) && (options.flags & FLG_MASK_CHK) &&
options.req_int_cand_target != 0 && mask_int_cand_target;
#else
#elif !defined(BENCH_BUILD)
int using_int_mask = 0;
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,9 @@ static void ldr_fill_user_words(struct db_main *db)
} else {
map_pos = mem_map;
map_end = mem_map + file_len;
#if MGETL_HAS_SIMD
map_scan_end = map_end - VSCANSZ;
#endif
}
#endif /* HAVE_MMAP */

Expand Down
3 changes: 2 additions & 1 deletion src/mgetl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
#if defined(vcmpeq_epi8_mask) && !defined(_MSC_VER) && !VLOADU_EMULATED
#define MGETL_HAS_SIMD 1
#define VSCANSZ sizeof(vtype)
static char *map_scan_end;
#else
#define VSCANSZ 0
#endif

static char *mem_map, *map_pos, *map_end, *map_scan_end;
static char *mem_map, *map_pos, *map_end;

#define GET_LINE(line, file) (mem_map ? mgetl(line) : fgetl(line, LINE_BUFFER_SIZE, file))

Expand Down
8 changes: 5 additions & 3 deletions src/wordlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#if AC_BUILT
#include "autoconfig.h"
#else
#ifndef sparc
#undef _POSIX_SOURCE
#define _POSIX_SOURCE /* for fileno(3) */
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE /* for fileno(3) and stat(2) */
#endif
#endif

#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

#if (!AC_BUILT || HAVE_UNISTD_H) && !_MSC_VER
Expand Down Expand Up @@ -638,7 +638,9 @@ void do_wordlist_crack(struct db_main *db, const char *name, int rules)
} else {
map_pos = mem_map;
map_end = mem_map + file_len;
#if MGETL_HAS_SIMD
map_scan_end = map_end - VSCANSZ;
#endif
}
}
#endif
Expand Down

0 comments on commit 77f0cee

Please sign in to comment.