[Forensics-changes] [yara] 270/407: Implement get_double().
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.3.0
in repository yara.
commit 6e6b906fd78e4067c07f52465b2b453c7c191f66
Author: Wesley Shields <wxs at atarininja.org>
Date: Mon Dec 29 15:20:43 2014 -0500
Implement get_double().
---
libyara/include/yara/modules.h | 4 ++++
libyara/object.c | 27 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/libyara/include/yara/modules.h b/libyara/include/yara/modules.h
index e9c4c49..03fcfa1 100644
--- a/libyara/include/yara/modules.h
+++ b/libyara/include/yara/modules.h
@@ -257,6 +257,10 @@ limitations under the License.
yr_object_get_integer(object, __VA_ARGS__)
+#define get_double(object, ...) \
+ yr_object_get_double(object, __VA_ARGS__)
+
+
#define get_string(object, ...) \
yr_object_get_string(object, __VA_ARGS__)
diff --git a/libyara/object.c b/libyara/object.c
index cb69dd5..e08688e 100644
--- a/libyara/object.c
+++ b/libyara/object.c
@@ -842,6 +842,33 @@ int64_t yr_object_get_integer(
}
+double yr_object_get_double(
+ YR_OBJECT* object,
+ const char* field,
+ ...)
+{
+ YR_OBJECT* double_obj;
+
+ va_list args;
+ va_start(args, field);
+
+ if (field != NULL)
+ double_obj = _yr_object_lookup(object, 0, field, args);
+ else
+ double_obj = object;
+
+ va_end(args);
+
+ if (double_obj == NULL)
+ return UNDEFINED;
+
+ assertf(double_obj->type == OBJECT_TYPE_DOUBLE,
+ "type of \"%s\" is not double\n", field);
+
+ return ((YR_OBJECT_DOUBLE*) double_obj)->value;
+}
+
+
SIZED_STRING* yr_object_get_string(
YR_OBJECT* object,
const char* field,
--
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