celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erjan Altena (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CELIX-380) PROPERTIES_FOR_EACH macro does not iterate over all keys
Date Mon, 10 Oct 2016 17:13:20 GMT
Erjan Altena created CELIX-380:
----------------------------------

             Summary: PROPERTIES_FOR_EACH macro does not iterate over all  keys
                 Key: CELIX-380
                 URL: https://issues.apache.org/jira/browse/CELIX-380
             Project: Celix
          Issue Type: Bug
          Components: Framework
    Affects Versions: 1.0.0-incubating
            Reporter: Erjan Altena
             Fix For: next


When using the macro PROPERTIES_FOR_EACH in properties.h always on key is missed.

The macro is defined as:
#define PROPERTIES_FOR_EACH(props, key) \
	for(hash_map_iterator_t iter = hashMapIterator_construct((props)); \
		hashMapIterator_hasNext(&iter); \
		(key) = (const char*)hashMapIterator_nextKey(&iter))

In the first iteration the variable key is not set. 

Also there is no hashMapIterator function to get the first value, only the next.

This could work if the  hashMapIterator_construct returns an iterator which is one before
the first value (i.e. index -1) but this seems not be the case.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message