skupperproject / skupper-router

An application-layer router for Skupper networks
https://skupper.io
Apache License 2.0
14 stars 18 forks source link

Modify qd_hash_retrieve_str in hash.c to return QD_ERROR_NOT_FOUND if the val is not found for key #1568

Closed ganeshmurthy closed 1 month ago

ganeshmurthy commented 1 month ago

Right now the qd_hash_retrieve_str function always returns QD_ERROR_NONE. It should look like this instead

qd_error_t qd_hash_retrieve_str(qd_hash_t *h, const unsigned char *key, void **val)
{
    qd_hash_item_t *item = qd_hash_internal_get_item_str(h,
                                                         qd_hash_get_bucket_str(h, key),
                                                         key);
    if (item) {
        *val = item->v.val;
        return QD_ERROR_NONE;
    } else {
        *val = 0;
        return QD_ERROR_NOT_FOUND;
    }
}