core/bus_center/lnn/net_ledger/common/src/lnn_map.c
/**
 * Get map value api
 *
 * @param : map Map see details in type Map
 *          key Map key
 * @return : value of key or NULL
 */
Get map value api
@param : map Map see details in type Map
key Map key
@return : value of key or NULL
Get map value api @param : map Map see details in type Map key Map key @return : value of key or NULL
void* LnnMapGet(const Map *map, const char *key)
{
    if (map == NULL || key == NULL || map->nodeSize == 0 || map->nodes == NULL) {
        return NULL;
    }
    uint32_t hash = MapHash(key);
    uint32_t idx = MapHashIdx(map, hash);
    MapNode *node = map->nodes[idx];
    while (node != NULL) {
        if (node->hash == hash && node->key != NULL && !strcmp(node->key, key)) {
            return node->value;
        }
        node = node->next;
    }
    return NULL;
}
void * LnnMapGet ( const Map * map , const char * key ) { if ( map == NULL || key == NULL || map -> nodeSize == 0 || map -> nodes == NULL ) { return NULL ; } uint32_t hash = MapHash ( key ) ; uint32_t idx = MapHashIdx ( map , hash ) ; MapNode * node = map -> nodes [ idx ] ; while ( node != NULL ) { if ( node -> hash == hash && node -> key != NULL && ! strcmp ( node -> key , key ) ) { return node -> value ; } node = node -> next ; } return NULL ; }
Get map value api
 @param : map Map see details in type Map
          key Map key
 @return : value of key or NULL
Get map value api @param : map Map see details in type Map key Map key @return : value of key or NULL