celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pepijn Noltes (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CELIX-380) PROPERTIES_FOR_EACH macro does not iterate over all keys
Date Tue, 11 Oct 2016 08:59:20 GMT

    [ 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)

Mime
View raw message