[Forensics-changes] [yara] 83/135: Remove yr_compiler_push_file_name from the public API
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:27:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.1.0
in repository yara.
commit d06a778bf3f874b6b4147e31b8033bedb6b9df54
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri Aug 8 17:02:08 2014 +0200
Remove yr_compiler_push_file_name from the public API
---
libyara/compiler.c | 10 +++++++---
libyara/include/yara/compiler.h | 12 +++++++++++-
libyara/lexer.c | 4 ++--
libyara/lexer.l | 4 ++--
yara-python/yara-python.c | 8 +++-----
yara.c | 4 +---
yarac.c | 4 +---
7 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/libyara/compiler.c b/libyara/compiler.c
index efe6c1b..5f88718 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -194,7 +194,7 @@ FILE* _yr_compiler_pop_file(
return result;
}
-int yr_compiler_push_file_name(
+int _yr_compiler_push_file_name(
YR_COMPILER* compiler,
const char* file_name)
{
@@ -230,7 +230,7 @@ int yr_compiler_push_file_name(
}
-void yr_compiler_pop_file_name(
+void _yr_compiler_pop_file_name(
YR_COMPILER* compiler)
{
if (compiler->file_name_stack_ptr > 0)
@@ -317,8 +317,12 @@ int _yr_compiler_set_namespace(
int yr_compiler_add_file(
YR_COMPILER* compiler,
FILE* rules_file,
- const char* namespace_)
+ const char* namespace_,
+ const char* file_name)
{
+ if (file_name != NULL)
+ _yr_compiler_push_file_name(compiler, file_name);
+
if (namespace_ != NULL)
_yr_compiler_set_namespace(compiler, namespace_);
else
diff --git a/libyara/include/yara/compiler.h b/libyara/include/yara/compiler.h
index 89b56a0..d7d3daf 100644
--- a/libyara/include/yara/compiler.h
+++ b/libyara/include/yara/compiler.h
@@ -110,6 +110,15 @@ FILE* _yr_compiler_pop_file(
YR_COMPILER* compiler);
+int _yr_compiler_push_file_name(
+ YR_COMPILER* compiler,
+ const char* file_name);
+
+
+void _yr_compiler_pop_file_name(
+ YR_COMPILER* compiler);
+
+
int yr_compiler_create(
YR_COMPILER** compiler);
@@ -126,7 +135,8 @@ void yr_compiler_set_callback(
int yr_compiler_add_file(
YR_COMPILER* compiler,
FILE* rules_file,
- const char* namespace_);
+ const char* namespace_,
+ const char* file_name);
int yr_compiler_add_string(
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 0d96481..a9062c5 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -1326,7 +1326,7 @@ YY_RULE_SETUP
if (fh != NULL)
{
- int error_code = yr_compiler_push_file_name(compiler, f);
+ int error_code = _yr_compiler_push_file_name(compiler, f);
if (error_code != ERROR_SUCCESS)
{
@@ -1377,7 +1377,7 @@ case YY_STATE_EOF(comment):
fclose(file);
}
- yr_compiler_pop_file_name(compiler);
+ _yr_compiler_pop_file_name(compiler);
yara_yypop_buffer_state(yyscanner);
if (!YY_CURRENT_BUFFER)
diff --git a/libyara/lexer.l b/libyara/lexer.l
index ca77ec3..3b6d1cc 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -210,7 +210,7 @@ include[ \t]+\" {
if (fh != NULL)
{
- int error_code = yr_compiler_push_file_name(compiler, f);
+ int error_code = _yr_compiler_push_file_name(compiler, f);
if (error_code != ERROR_SUCCESS)
{
@@ -257,7 +257,7 @@ include[ \t]+\" {
fclose(file);
}
- yr_compiler_pop_file_name(compiler);
+ _yr_compiler_pop_file_name(compiler);
yypop_buffer_state(yyscanner);
if (!YY_CURRENT_BUFFER)
diff --git a/yara-python/yara-python.c b/yara-python/yara-python.c
index 2a94433..f204365 100644
--- a/yara-python/yara-python.c
+++ b/yara-python/yara-python.c
@@ -1245,8 +1245,7 @@ static PyObject * yara_compile(
if (fh != NULL)
{
- yr_compiler_push_file_name(compiler, filepath);
- error = yr_compiler_add_file(compiler, fh, NULL);
+ error = yr_compiler_add_file(compiler, fh, NULL, filepath);
fclose(fh);
}
else
@@ -1262,7 +1261,7 @@ static PyObject * yara_compile(
{
fd = dup(PyObject_AsFileDescriptor(file));
fh = fdopen(fd, "r");
- error = yr_compiler_add_file(compiler, fh, NULL);
+ error = yr_compiler_add_file(compiler, fh, NULL, NULL);
fclose(fh);
}
else if (sources_dict != NULL)
@@ -1313,8 +1312,7 @@ static PyObject * yara_compile(
if (fh != NULL)
{
- yr_compiler_push_file_name(compiler, filepath);
- error = yr_compiler_add_file(compiler, fh, ns);
+ error = yr_compiler_add_file(compiler, fh, ns, filepath);
fclose(fh);
if (error > 0)
diff --git a/yara.c b/yara.c
index fedb327..aff7710 100644
--- a/yara.c
+++ b/yara.c
@@ -1070,9 +1070,7 @@ int main(
return EXIT_FAILURE;
}
- yr_compiler_push_file_name(compiler, argv[optind]);
-
- errors = yr_compiler_add_file(compiler, rule_file, NULL);
+ errors = yr_compiler_add_file(compiler, rule_file, NULL, argv[optind]);
fclose(rule_file);
diff --git a/yarac.c b/yarac.c
index 8b1f8de..5458c79 100644
--- a/yarac.c
+++ b/yarac.c
@@ -202,9 +202,7 @@ int main(
if (rule_file != NULL)
{
- yr_compiler_push_file_name(compiler, argv[i]);
-
- errors = yr_compiler_add_file(compiler, rule_file, NULL);
+ errors = yr_compiler_add_file(compiler, rule_file, NULL, argv[i]);
fclose(rule_file);
--
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