commit 5b946fa8902d9a976eca0cc12997010c6e07e79b
Author: Yoann Vandoorselaere <[email protected]>
Date: Tue May 19 16:46:55 2009 +0200
Minor API fixes
The idmef_value_type_check_operator() function should take an idmef_value_type_id_t
argument. There is no API breakage since idmef-value-type API is considered private.
========================================
src/idmef-criterion-value.c | 12 ++++++------
src/idmef-value-type.c | 8 ++++----
src/idmef-value.c | 3 +--
src/include/idmef-value-type.h | 2 +-
4 files changed, 12 insertions(+), 13 deletions(-)
========================================
diff --git a/src/idmef-criterion-value.c b/src/idmef-criterion-value.c
index 73db9aa..70efd0d 100644
--- a/src/idmef-criterion-value.c
+++ b/src/idmef-criterion-value.c
@@ -735,29 +735,29 @@ int idmef_criterion_value_new_from_string(idmef_criterion_value_t **cv,
{
int ret;
idmef_value_t *val;
- idmef_value_type_t type;
+ idmef_value_type_id_t tid;
- type.id = idmef_path_get_value_type(path, -1);
+ tid = idmef_path_get_value_type(path, -1);
- if ( type.id == IDMEF_VALUE_TYPE_TIME ) {
+ if ( tid == 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 &&
- (type.id == IDMEF_VALUE_TYPE_STRING || type.id == IDMEF_VALUE_TYPE_ENUM || type.id == IDMEF_VALUE_TYPE_DATA) )
+ (tid == IDMEF_VALUE_TYPE_STRING || tid == IDMEF_VALUE_TYPE_ENUM || tid == 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.
*/
- ret = idmef_value_type_check_operator(&type, operator);
+ ret = idmef_value_type_check_operator(tid, operator);
if ( ret < 0 )
return ret;
- if ( type.id == IDMEF_VALUE_TYPE_ENUM && operator & IDMEF_CRITERION_OPERATOR_SUBSTR )
+ if ( tid == IDMEF_VALUE_TYPE_ENUM && operator & IDMEF_CRITERION_OPERATOR_SUBSTR )
ret = idmef_value_new_from_string(&val, IDMEF_VALUE_TYPE_STRING, value);
else
ret = idmef_value_new_from_path(&val, path, value);
diff --git a/src/idmef-value-type.c b/src/idmef-value-type.c
index 90c7f75..161b20f 100644
--- a/src/idmef-value-type.c
+++ b/src/idmef-value-type.c
@@ -732,18 +732,18 @@ void idmef_value_type_destroy(idmef_value_type_t *type)
-int idmef_value_type_check_operator(const idmef_value_type_t *type, idmef_criterion_operator_t op)
+int idmef_value_type_check_operator(idmef_value_type_id_t type, idmef_criterion_operator_t op)
{
int ret;
- ret = is_type_valid(type->id);
+ ret = is_type_valid(type);
if ( ret < 0 )
return ret;
- if ( (~ops_tbl[type->id].operator & op) == 0 )
+ if ( (~ops_tbl[type].operator & op) == 0 )
return 0;
return prelude_error_verbose(PRELUDE_ERROR_IDMEF_CRITERION_UNSUPPORTED_OPERATOR,
"Object type '%s' does not support operator '%s'",
- idmef_value_type_to_string(type->id), idmef_criterion_operator_to_string(op));
+ idmef_value_type_to_string(type), idmef_criterion_operator_to_string(op));
}
diff --git a/src/idmef-value.c b/src/idmef-value.c
index 85d09e2..ff3be40 100644
--- a/src/idmef-value.c
+++ b/src/idmef-value.c
@@ -826,8 +826,7 @@ int idmef_value_match(idmef_value_t *val1, idmef_value_t *val2, idmef_criterion_
int idmef_value_check_operator(const idmef_value_t *value, idmef_criterion_operator_t op)
{
prelude_return_val_if_fail(value, prelude_error(PRELUDE_ERROR_ASSERTION));
-
- return idmef_value_type_check_operator(&value->type, op);
+ return idmef_value_type_check_operator(value->type.id, op);
}
diff --git a/src/include/idmef-value-type.h b/src/include/idmef-value-type.h
index 159ca0e..2d29a3f 100644
--- a/src/include/idmef-value-type.h
+++ b/src/include/idmef-value-type.h
@@ -107,7 +107,7 @@ int idmef_value_type_clone(const idmef_value_type_t *src, idmef_value_type_t *ds
int idmef_value_type_compare(const idmef_value_type_t *type1, const idmef_value_type_t *type2,
idmef_criterion_operator_t op);
-int idmef_value_type_check_operator(const idmef_value_type_t *type, idmef_criterion_operator_t op);
+int idmef_value_type_check_operator(idmef_value_type_id_t type, idmef_criterion_operator_t op);
const char *idmef_value_type_to_string(idmef_value_type_id_t type);
_______________________________________________
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.