2424#include "tm_scope.h"
2525#include "topology_manager.h"
2626#include "celix_utils.h"
27- #include "filter .h"
27+ #include "celix_filter .h"
2828
2929static bool import_equal (celix_array_list_entry_t src , celix_array_list_entry_t dest );
3030
@@ -124,7 +124,7 @@ celix_status_t tm_addImportScope(void *handle, char *filter) {
124124 memset (& entry , 0 , sizeof (entry ));
125125 entry .voidPtrVal = new ;
126126 int index = celix_arrayList_indexOf (scope -> importScopes , entry );
127- filter_pt present = ( filter_pt ) celix_arrayList_get (scope -> importScopes , index );
127+ celix_filter_t * present = celix_arrayList_get (scope -> importScopes , index );
128128 if (present == NULL ) {
129129 celix_arrayList_add (scope -> importScopes , celix_steal_ptr (new ));
130130 } else {
@@ -142,12 +142,12 @@ celix_status_t tm_addImportScope(void *handle, char *filter) {
142142celix_status_t tm_removeImportScope (void * handle , char * filter ) {
143143 celix_status_t status = CELIX_SUCCESS ;
144144 scope_pt scope = (scope_pt ) handle ;
145- filter_pt new ;
145+ celix_filter_t * new ;
146146
147147 if (handle == NULL )
148148 return CELIX_ILLEGAL_ARGUMENT ;
149149
150- new = filter_create (filter );
150+ new = celix_filter_create (filter );
151151 if (new == NULL ) {
152152 return CELIX_ILLEGAL_ARGUMENT ; // filter not parsable
153153 }
@@ -157,19 +157,19 @@ celix_status_t tm_removeImportScope(void *handle, char *filter) {
157157 memset (& entry , 0 , sizeof (entry ));
158158 entry .voidPtrVal = new ;
159159 int index = celix_arrayList_indexOf (scope -> importScopes , entry );
160- filter_pt present = ( filter_pt ) celix_arrayList_get (scope -> importScopes , index );
160+ celix_filter_t * present = celix_arrayList_get (scope -> importScopes , index );
161161 if (present == NULL )
162162 status = CELIX_ILLEGAL_ARGUMENT ;
163163 else {
164164 celix_arrayList_remove (scope -> importScopes , present );
165- filter_destroy (present );
165+ celix_filter_destroy (present );
166166 }
167167 celixThreadMutex_unlock (& scope -> importScopeLock );
168168 }
169169 if (scope -> importScopeChangedHandler != NULL ) {
170170 status = CELIX_DO_IF (status , scope -> importScopeChangedHandler (scope -> manager , filter ));
171171 }
172- filter_destroy (new );
172+ celix_filter_destroy (new );
173173 return status ;
174174}
175175
@@ -228,8 +228,8 @@ celix_status_t scope_scopeDestroy(scope_pt scope) {
228228
229229 if (celixThreadMutex_lock (& scope -> importScopeLock ) == CELIX_SUCCESS ) {
230230 for (int i = 0 ; i < celix_arrayList_size (scope -> importScopes ); i ++ ) {
231- filter_pt element = ( filter_pt ) celix_arrayList_get (scope -> importScopes , i );
232- filter_destroy (element );
231+ celix_filter_t * element = celix_arrayList_get (scope -> importScopes , i );
232+ celix_filter_destroy (element );
233233 }
234234 celix_arrayList_destroy (scope -> importScopes );
235235 celixThreadMutex_unlock (& scope -> importScopeLock );
@@ -245,13 +245,11 @@ celix_status_t scope_scopeDestroy(scope_pt scope) {
245245 * STATIC FUNCTIONS
246246 *****************************************************************************/
247247static bool import_equal (celix_array_list_entry_t src , celix_array_list_entry_t dest ) {
248- celix_status_t status ;
249-
250- filter_pt src_filter = (filter_pt ) src .voidPtrVal ;
251- filter_pt dest_filter = (filter_pt ) dest .voidPtrVal ;
248+ celix_filter_t * src_filter = src .voidPtrVal ;
249+ celix_filter_t * dest_filter = dest .voidPtrVal ;
252250 bool result ;
253- status = filter_match_filter (src_filter , dest_filter , & result );
254- return ( status == CELIX_SUCCESS ) && result ;
251+ result = celix_filter_equals (src_filter , dest_filter );
252+ return result ;
255253}
256254
257255bool scope_allowImport (scope_pt scope , endpoint_description_t * endpoint ) {
@@ -262,8 +260,8 @@ bool scope_allowImport(scope_pt scope, endpoint_description_t *endpoint) {
262260 allowImport = true;
263261 } else {
264262 for (int i = 0 ; i < celix_arrayList_size (scope -> importScopes ); i ++ ) {
265- filter_pt element = ( filter_pt ) celix_arrayList_get (scope -> importScopes , i );
266- filter_match (element , endpoint -> properties , & allowImport );
263+ celix_filter_t * element = celix_arrayList_get (scope -> importScopes , i );
264+ allowImport = celix_filter_match (element , endpoint -> properties );
267265 if (allowImport ) {
268266 break ;
269267 }
@@ -310,7 +308,7 @@ celix_status_t scope_getExportProperties(scope_pt scope, service_reference_pt re
310308 celix_autoptr (celix_filter_t ) filter = celix_filter_create (filterStr );
311309 if (filter != NULL ) {
312310 // test if the scope filter matches the exported service properties
313- status = filter_match (filter , serviceProperties , & found );
311+ found = celix_filter_match (filter , serviceProperties );
314312 if (found ) {
315313 struct scope_item * item = (struct scope_item * ) hashMapEntry_getValue (scopedEntry );
316314 * props = item -> props ;
0 commit comments