Commit 7874ab0f authored by Paul Querna's avatar Paul Querna
Browse files

* cache/mod_disk_cache.c: Make most members of disk_cache_object into const...

* cache/mod_disk_cache.c: Make most members of disk_cache_object into const char*. This removes the need to cast the const out in several places.
* cache/mod_cache.h: Make cache_object.key a const.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190535 13f79535-47bb-0310-9956-ffa450edef68
parent 431b8efd
Loading
Loading
Loading
Loading
+1 −1
Changes for modules/cache/mod_cache.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ struct cache_info {
 */
typedef struct cache_object cache_object_t;
struct cache_object {
    char *key;
    const char *key;
    cache_object_t *next;
    cache_info info;
    /* Opaque portion (specific to the implementation) of the cache object */
+13 −13
Changes for modules/cache/mod_disk_cache.c: 13 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -75,12 +75,12 @@ typedef struct {
 */
typedef struct disk_cache_object {
    const char *root;        /* the location of the cache directory */
    char *tempfile;          /* temp file tohold the content */
    char *datafile;          /* name of file where the data will go */
    char *hdrsfile;          /* name of file where the hdrs will go */
    char *hashfile;          /* Computed hash key for this URI */
    char *name;   /* Requested URI without vary bits - suitable for mortals. */
    char *key;    /* On-disk prefix; URI with Vary bits (if present) */
    const char *tempfile;    /* temp file tohold the content */
    const char *datafile;    /* name of file where the data will go */
    const char *hdrsfile;    /* name of file where the hdrs will go */
    const char *hashfile;    /* Computed hash key for this URI */
    const char *name;   /* Requested URI without vary bits - suitable for mortals. */
    const char *key;    /* On-disk prefix; URI with Vary bits (if present) */
    apr_file_t *fd;          /* data file */
    apr_file_t *hfd;         /* headers file */
    apr_file_t *tfd;         /* temporary file for data */
@@ -146,12 +146,12 @@ static char *data_file(apr_pool_t *p, disk_cache_conf *conf,
                       CACHE_DATA_SUFFIX, NULL);
}

static void mkdir_structure(disk_cache_conf *conf, char *file, apr_pool_t *pool)
static void mkdir_structure(disk_cache_conf *conf, const char *file, apr_pool_t *pool)
{
    apr_status_t rv;
    char *p;

    for (p = file + conf->cache_root_len + 1;;) {
    for (p = (char*)file + conf->cache_root_len + 1;;) {
        p = strchr(p, '/');
        if (!p)
            break;
@@ -255,7 +255,7 @@ static int file_cache_recall_mydata(apr_file_t *fd, cache_info *info,
    return APR_SUCCESS;
}

static char* regen_key(apr_pool_t *p, apr_table_t *headers,
static const char* regen_key(apr_pool_t *p, apr_table_t *headers,
                             apr_array_header_t *varray, const char *oldkey)
{
    struct iovec *iov;
@@ -363,7 +363,7 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
{
    apr_uint32_t format;
    apr_size_t len;
    char *nkey;
    const char *nkey;
    apr_status_t rc;
    static int error_logged = 0;
    disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
@@ -448,12 +448,12 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
         * start of the file again, so that later reads work. 
         */
        apr_file_seek(dobj->hfd, APR_SET, &offset);
        nkey = (char*)key;
        nkey = key;
    }

    obj->key = nkey;
    dobj->key = nkey;
    dobj->name = (char*)key;
    dobj->name = key;
    dobj->datafile = data_file(r->pool, conf, dobj, nkey);
    dobj->tempfile = apr_pstrcat(r->pool, conf->cache_root, AP_TEMPFILE, NULL);

@@ -813,7 +813,7 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info

    iov[0].iov_base = (void*)&disk_info;
    iov[0].iov_len = sizeof(disk_cache_info_t);
    iov[1].iov_base = dobj->name;
    iov[1].iov_base = (void*)dobj->name;
    iov[1].iov_len = disk_info.name_len;

    rv = apr_file_writev(dobj->hfd, (const struct iovec *) &iov, 2, &amt);