[Forensics-changes] [yara] 149/192: Allow defining MAX_THREADS during compile time

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:31:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.6.0
in repository yara.

commit 21070094e40008bc55f9c89d9a229a6a669bc0ae
Author: plusvic <plusvic at gmail.com>
Date:   Tue Apr 25 16:21:10 2017 +0200

    Allow defining MAX_THREADS during compile time
---
 libyara/arena.c               | 2 +-
 libyara/include/yara/arena.h  | 2 +-
 libyara/include/yara/limits.h | 2 ++
 yara.c                        | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libyara/arena.c b/libyara/arena.c
index 1357318..48faa42 100644
--- a/libyara/arena.c
+++ b/libyara/arena.c
@@ -56,7 +56,7 @@ typedef struct _ARENA_FILE_HEADER
 {
   char      magic[4];
   uint32_t  size;
-  uint8_t   version;
+  uint32_t  version;
 
 } ARENA_FILE_HEADER;
 
diff --git a/libyara/include/yara/arena.h b/libyara/include/yara/arena.h
index af80b17..1e66cc8 100644
--- a/libyara/include/yara/arena.h
+++ b/libyara/include/yara/arena.h
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #define ARENA_FLAGS_FIXED_SIZE   1
 #define ARENA_FLAGS_COALESCED    2
-#define ARENA_FILE_VERSION       12
+#define ARENA_FILE_VERSION       ((13 << 16) | MAX_THREADS)
 
 #define EOL ((size_t) -1)
 
diff --git a/libyara/include/yara/limits.h b/libyara/include/yara/limits.h
index c9702a6..af30d55 100644
--- a/libyara/include/yara/limits.h
+++ b/libyara/include/yara/limits.h
@@ -39,7 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // MAX_THREADS is the number of threads that can use a YR_RULES
 // object simultaneously.
 
+#ifndef MAX_THREADS
 #define MAX_THREADS 32
+#endif
 
 
 #ifndef MAX_PATH
diff --git a/yara.c b/yara.c
index ded53fd..a426e01 100644
--- a/yara.c
+++ b/yara.c
@@ -132,7 +132,7 @@ static int count = 0;
 static int limit = 0;
 static int timeout = 1000000;
 static int stack_size = DEFAULT_STACK_SIZE;
-static int threads = 8;
+static int threads = MAX_THREADS;
 static int fail_on_warnings = FALSE;
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list