You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by "Erjan Altena (JIRA)" <ji...@apache.org> on 2016/10/10 17:13:20 UTC

[jira] [Created] (CELIX-380) PROPERTIES_FOR_EACH macro does not iterate over all keys

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)