void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
    unsigned long hash;
    OPENSSL_LH_NODE *nn, **rn;
    void *ret;
    lh->error = 0;
    rn = getrn(lh, data, &hash);
    if (*rn == NULL) {
        lh->num_no_delete++;
        return (NULL);
    } else {
        nn = *rn;
        *rn = nn->next;
        ret = nn->data;
        OPENSSL_free(nn);
        lh->num_delete++;
    }
    lh->num_items--;
    if ((lh->num_nodes > MIN_NODES) &&
        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
        contract(lh);
    return (ret);
}
['static int test_stress(void)\n{\n    LHASH_OF(int) *h = lh_int_new(&stress_hash, &int_cmp);\n    const unsigned int n = 2500000;\n    unsigned int i;\n    int testresult = 0, *p;\n    if (h == NULL) {\n        fprintf(stderr, "test lhash stress allocation\\n");\n        goto end;\n    }\n    for (i = 0; i < n; i++) {\n        p = OPENSSL_malloc(sizeof(i));\n        if (p == NULL) {\n            fprintf(stderr, "test lhash stress out of memory %d\\n", i);\n            goto end;\n        }\n        *p = 3 * i + 1;\n        lh_int_insert(h, p);\n    }\n    if (lh_int_num_items(h) != n) {\n            fprintf(stderr, "test lhash stress num items\\n");\n            goto end;\n    }\n    fprintf(stderr, "hash full statistics:\\n");\n    OPENSSL_LH_stats((OPENSSL_LHASH *)h, stderr);\n    fprintf(stderr, "\\nhash full node usage:\\n");\n    OPENSSL_LH_node_usage_stats((OPENSSL_LHASH *)h, stderr);\n    for (i = 0; i < n; i++) {\n        const int j = (7 * i + 4) % n * 3 + 1;\n        if ((p = lh_int_delete(h, &j)) == NULL) {\n            fprintf(stderr, "test lhash stress delete %d\\n", i);\n            goto end;\n        }\n        if (*p != j) {\n            fprintf(stderr, "test lhash stress bad value %d\\n", i);\n            goto end;\n        }\n        OPENSSL_free(p);\n    }\n    fprintf(stderr, "\\nhash empty statistics:\\n");\n    OPENSSL_LH_stats((OPENSSL_LHASH *)h, stderr);\n    fprintf(stderr, "\\nhash empty node usage:\\n");\n    OPENSSL_LH_node_usage_stats((OPENSSL_LHASH *)h, stderr);\n    testresult = 1;\nend:\n    lh_int_free(h);\n    return testresult;\n}', 'DEFINE_LHASH_OF(int)', 'void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))\n        return NULL;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {\n            lh->error++;\n            return (NULL);\n        }\n        nn->data = data;\n        nn->next = NULL;\n        nn->hash = hash;\n        *rn = nn;\n        ret = NULL;\n        lh->num_insert++;\n        lh->num_items++;\n    } else {\n        ret = (*rn)->data;\n        (*rn)->data = data;\n        lh->num_replace++;\n    }\n    return (ret);\n}', 'void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_no_delete++;\n        return (NULL);\n    } else {\n        nn = *rn;\n        *rn = nn->next;\n        ret = nn->data;\n        OPENSSL_free(nn);\n        lh->num_delete++;\n    }\n    lh->num_items--;\n    if ((lh->num_nodes > MIN_NODES) &&\n        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))\n        contract(lh);\n    return (ret);\n}']