/* Group delete callback function when polling the block.  */
static int32_t __item_del_by_prefix_cb(kv_item_t *item, const char *prefix)
/* Group delete callback function when polling the block.  */
static int32_t __item_del_by_prefix_cb(kv_item_t *item, const char *prefix)
{
    char *key = NULL;
    if (prefix != NULL && item->hdr.key_len < strlen(prefix)) {
        return KV_LOOP_CONTINUE;
    }
    key = (char *)kv_malloc(item->hdr.key_len + 1);
    if (!key) {
        return KV_ERR_MALLOC_FAILED;
    }
    memset(key, 0, item->hdr.key_len + 1);
    kv_flash_read(item->pos + KV_ITEM_HDR_SIZE, key, item->hdr.key_len);
    if (prefix == NULL || strncmp(key, prefix, strlen(prefix)) == 0) {
        kv_item_del(item, KV_DELETE_FLAG);
    }
    kv_free(key);
    return KV_LOOP_CONTINUE;
}