You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by "Pepijn Noltes (JIRA)" <ji...@apache.org> on 2016/10/11 08:59:20 UTC
[jira] [Commented] (CELIX-380) PROPERTIES_FOR_EACH macro does not
iterate over all keys
[ https://issues.apache.org/jira/browse/CELIX-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15564950#comment-15564950 ]
Pepijn Noltes commented on CELIX-380:
-------------------------------------
Merged with pull request #10
> 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.
> The solution below works:
> #define PROPERTIES_FOR_EACH(props, key) \
> for(hash_map_iterator_t iter = hashMapIterator_construct(props); \
> hashMapIterator_hasNext(&iter), (key) = (const char*)hashMapIterator_nextKey(&iter);)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)