jermus67 commented on a change in pull request #385:
URL: https://github.com/apache/celix/pull/385#discussion_r774231769



##########
File path: libs/utils/src/filter.c
##########
@@ -725,4 +724,71 @@ const char* celix_filter_findAttribute(const 
celix_filter_t *filter, const char
         }
     }
     return result;
+}
+
+static bool hasMandatoryEqualsValueAttribute(const celix_filter_t *filter, 
const char *attribute, bool negated, bool optional) {
+    bool equalsValueAttribute = false;
+
+    if (filter != NULL && attribute != NULL) {
+        if (filter->operand == CELIX_FILTER_OPERAND_AND || filter->operand == 
CELIX_FILTER_OPERAND_OR || filter->operand == CELIX_FILTER_OPERAND_NOT) {
+            size_t size = celix_arrayList_size(filter->children);
+            for (unsigned int i = 0; i < size; ++i) {
+
+                if (filter->operand == CELIX_FILTER_OPERAND_NOT) {
+                    negated = !negated;
+                } else if (filter->operand == CELIX_FILTER_OPERAND_OR) {
+                    optional = true;
+                }
+
+                celix_filter_t *child = celix_arrayList_get(filter->children, 
i);
+
+                equalsValueAttribute = hasMandatoryEqualsValueAttribute(child, 
attribute, negated, optional);
+
+                if (equalsValueAttribute) {
+                    break;
+                }
+            }
+        } else if (filter->operand == CELIX_FILTER_OPERAND_EQUAL) {
+            equalsValueAttribute = (strncmp(filter->attribute, attribute, 1024 
* 1024) == 0) && (!negated) && (!optional);

Review comment:
       changed strncmp to celix_utils_stringEquals




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to