Commit 3b0ca8e1 authored by Jean-Frederic Clere's avatar Jean-Frederic Clere
Browse files

Correct small errors: Thanks Ruediger Pluem who review the code.

parent 5ca000dd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
                *new = next;
                return APR_SUCCESS;
            }
            if (next->next)
            if (!next->next)
                break;
            next = next->next;
        }
@@ -84,7 +84,6 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
    res->base =  apr_pcalloc(globalpool, item_size * item_num);
    if (!res->base)
        return APR_ENOSHMAVAIL;
    memset(res->base, 0, item_size * item_num);

    /* For the chained slotmem stuff */
    res->name = apr_pstrdup(globalpool, fname);
@@ -102,13 +101,14 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
{

    void *ptr = score->base + score->size * id;
    void *ptr;

    if (!score)
        return APR_ENOSHMAVAIL;
    if (id<0 || id>score->num)
        return APR_ENOSHMAVAIL;

    ptr = score->base + score->size * id;
    if (!ptr)
        return APR_ENOSHMAVAIL;
    *mem = ptr;
+0 −5
Original line number Diff line number Diff line
@@ -82,9 +82,6 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
    res->size = item_size;
    res->num = item_num;
    *new = res;
    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
                "ap_slotmem_create: score %d", score);

    return APR_SUCCESS;
}
static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
@@ -103,8 +100,6 @@ static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
    if (!ptr)
        return APR_ENOSHMAVAIL;
    *mem = ptr;
    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
                "ap_slotmem_mem: score %d", score);
    return APR_SUCCESS;
}

+3 −8
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
                *new = next;
                return APR_SUCCESS;
            }
            if (next->next)
            if (!next->next)
                break;
            next = next->next;
        }
@@ -130,15 +130,14 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
{

    void *ptr = score->base + score->size * id;
    void *ptr;

    if (!score)
        return APR_ENOSHMAVAIL;
    if (id<0 || id>score->num)
        return APR_ENOSHMAVAIL;
    if (apr_shm_size_get(score->shm) != score->size * score->num)
        return APR_ENOSHMAVAIL;

    ptr = score->base + score->size * id;
    if (!ptr)
        return APR_ENOSHMAVAIL;
    *mem = ptr;
@@ -154,10 +153,6 @@ static const slotmem_storage_method storage = {
/* make sure the shared memory is cleaned */
static int initialize_cleanup(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
    ap_slotmem_t *next = globallistmem;
    while (next) {
        next = next->next;
    }
    apr_pool_cleanup_register(p, &globallistmem, cleanup_slotmem, apr_pool_cleanup_null);
    return OK;
}