commit b8bd6a3ffad39a646d2601d638405ebc0d5f22ad
Author: Yoann Vandoorselaere <[email protected]>
Date: Fri May 15 17:07:54 2009 +0200
Minor optimisation
Fetch the value type only once.
========================================
src/idmef-criterion-value.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
========================================
diff --git a/src/idmef-criterion-value.c b/src/idmef-criterion-value.c
index 5d0ed83..35cac23 100644
--- a/src/idmef-criterion-value.c
+++ b/src/idmef-criterion-value.c
@@ -737,24 +737,22 @@ int idmef_criterion_value_new_from_string(idmef_criterion_value_t **cv,
idmef_value_t *val;
idmef_value_type_t type;
- if ( idmef_path_get_value_type(path, -1) == IDMEF_VALUE_TYPE_TIME ) {
+ type.id = idmef_path_get_value_type(path, -1);
+
+ if ( type.id == IDMEF_VALUE_TYPE_TIME ) {
ret = idmef_criterion_value_new_broken_down_time(cv, value, operator);
if ( ret == 0 )
return ret;
}
else if ( operator & IDMEF_CRITERION_OPERATOR_REGEX &&
- (idmef_path_get_value_type(path, -1) == IDMEF_VALUE_TYPE_STRING ||
- idmef_path_get_value_type(path, -1) == IDMEF_VALUE_TYPE_ENUM ||
- idmef_path_get_value_type(path, -1) == IDMEF_VALUE_TYPE_DATA) )
+ (type.id == IDMEF_VALUE_TYPE_STRING || type.id == IDMEF_VALUE_TYPE_ENUM || type.id == IDMEF_VALUE_TYPE_DATA) )
return idmef_criterion_value_new_regex(cv, value, operator);
/*
* It's more understandable for the user if we check the operator
* prior to checking the value.
*/
- type.id = idmef_path_get_value_type(path, -1);
-
ret = idmef_value_type_check_operator(&type, operator);
if ( ret < 0 )
return ret;
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.