Received: by taz.hyperreal.com (8.7.5/V2.0) id KAA06330; Sun, 6 Oct 1996 10:29:59 -0700 (PDT) Received: by taz.hyperreal.com (8.7.5/V2.0) id KAA06314; Sun, 6 Oct 1996 10:29:58 -0700 (PDT) Date: Sun, 6 Oct 1996 10:29:58 -0700 (PDT) From: Ben Laurie Message-Id: <199610061729.KAA06314@taz.hyperreal.com> To: apache-cvs@hyperreal.com Subject: cvs commit: apache/src alloc.c alloc.h Sender: owner-apache-cvs@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com ben 96/10/06 10:29:57 Modified: src alloc.c alloc.h Log: Make things const where appropriate. Revision Changes Path 1.15 +12 -11 apache/src/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C3 -r1.14 -r1.15 *** alloc.c 1996/10/01 19:19:14 1.14 --- alloc.c 1996/10/06 17:29:55 1.15 *************** *** 50,56 **** * */ ! /* $Id: alloc.c,v 1.14 1996/10/01 19:19:14 brian Exp $ */ /* --- 50,56 ---- * */ ! /* $Id: alloc.c,v 1.15 1996/10/06 17:29:55 ben Exp $ */ /* *************** *** 472,478 **** return arr->elts + (arr->elt_size * (arr->nelts - 1)); } ! void array_cat (array_header *dst, array_header *src) { int elt_size = dst->elt_size; --- 472,478 ---- return arr->elts + (arr->elt_size * (arr->nelts - 1)); } ! void array_cat (array_header *dst, const array_header *src) { int elt_size = dst->elt_size; *************** *** 496,502 **** dst->nelts += src->nelts; } ! array_header *copy_array (pool *p, array_header *arr) { array_header *res = make_array (p, arr->nalloc, arr->elt_size); --- 496,502 ---- dst->nelts += src->nelts; } ! array_header *copy_array (pool *p, const array_header *arr) { array_header *res = make_array (p, arr->nalloc, arr->elt_size); *************** *** 512,518 **** * overhead of the full copy only where it is really needed. */ ! array_header *copy_array_hdr (pool *p, array_header *arr) { array_header *res = (array_header *)palloc(p, sizeof(array_header)); --- 512,518 ---- * overhead of the full copy only where it is really needed. */ ! array_header *copy_array_hdr (pool *p, const array_header *arr) { array_header *res = (array_header *)palloc(p, sizeof(array_header)); *************** *** 529,535 **** /* The above is used here to avoid consing multiple new array bodies... */ array_header *append_arrays (pool *p, ! array_header *first, array_header *second) { array_header *res = copy_array_hdr (p, first); --- 529,536 ---- /* The above is used here to avoid consing multiple new array bodies... */ array_header *append_arrays (pool *p, ! const array_header *first, ! const array_header *second) { array_header *res = copy_array_hdr (p, first); *************** *** 547,559 **** return make_array (p, nelts, sizeof (table_entry)); } ! table *copy_table (pool *p, table *t) { return copy_array (p, t); } array_header *table_elts (table *t) { return t; } ! char *table_get (table *t, char *key) { table_entry *elts = (table_entry *)t->elts; int i; --- 548,560 ---- return make_array (p, nelts, sizeof (table_entry)); } ! table *copy_table (pool *p, const table *t) { return copy_array (p, t); } array_header *table_elts (table *t) { return t; } ! char *table_get (const table *t, const char *key) { table_entry *elts = (table_entry *)t->elts; int i; *************** *** 583,589 **** elts->val = pstrdup (t->pool, val); } ! void table_unset( table *t, char *key ) { table_entry *elts = (table_entry *)t->elts; int i; --- 584,590 ---- elts->val = pstrdup (t->pool, val); } ! void table_unset( table *t, const char *key ) { table_entry *elts = (table_entry *)t->elts; int i; *************** *** 611,617 **** } } ! void table_merge (table *t, char *key, char *val) { table_entry *elts = (table_entry *)t->elts; int i; --- 612,618 ---- } } ! void table_merge (table *t, const char *key, const char *val) { table_entry *elts = (table_entry *)t->elts; int i; *************** *** 627,633 **** elts->val = pstrdup (t->pool, val); } ! void table_add (table *t, char *key, char *val) { table_entry *elts = (table_entry *)t->elts; --- 628,634 ---- elts->val = pstrdup (t->pool, val); } ! void table_add (table *t, const char *key, const char *val) { table_entry *elts = (table_entry *)t->elts; *************** *** 636,642 **** elts->val = pstrdup (t->pool, val); } ! table* overlay_tables (pool *p, table *overlay, table *base) { return append_arrays (p, overlay, base); } --- 637,643 ---- elts->val = pstrdup (t->pool, val); } ! table* overlay_tables (pool *p, const table *overlay, const table *base) { return append_arrays (p, overlay, base); } 1.11 +12 -11 apache/src/alloc.h Index: alloc.h =================================================================== RCS file: /export/home/cvs/apache/src/alloc.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C3 -r1.10 -r1.11 *** alloc.h 1996/08/20 11:50:38 1.10 --- alloc.h 1996/10/06 17:29:55 1.11 *************** *** 51,57 **** * */ ! /* $Id: alloc.h,v 1.10 1996/08/20 11:50:38 paul Exp $ */ /* * Resource allocation routines... --- 51,57 ---- * */ ! /* $Id: alloc.h,v 1.11 1996/10/06 17:29:55 ben Exp $ */ /* * Resource allocation routines... *************** *** 113,128 **** array_header *make_array (pool *p, int nelts, int elt_size); void *push_array (array_header *); ! void array_cat (array_header *dst, array_header *src); ! array_header *append_arrays (pool *, array_header *, array_header *); /* copy_array copies the *entire* array. copy_array_hdr just copies * the header, and arranges for the elements to be copied if (and only * if) the code subsequently does a push or arraycat. */ ! array_header *copy_array (pool *p, array_header *src); ! array_header *copy_array_hdr (pool *p, array_header *src); /* Tables. Implemented alist style, for now, though we try to keep --- 113,129 ---- array_header *make_array (pool *p, int nelts, int elt_size); void *push_array (array_header *); ! void array_cat (array_header *dst, const array_header *src); ! array_header *append_arrays (pool *, const array_header *, ! const array_header *); /* copy_array copies the *entire* array. copy_array_hdr just copies * the header, and arranges for the elements to be copied if (and only * if) the code subsequently does a push or arraycat. */ ! array_header *copy_array (pool *p, const array_header *src); ! array_header *copy_array_hdr (pool *p, const array_header *src); /* Tables. Implemented alist style, for now, though we try to keep *************** *** 144,157 **** } table_entry; table *make_table (pool *p, int nelts); ! table *copy_table (pool *p, table *); ! char *table_get (table *, char *); void table_set (table *, const char *name, const char *val); ! void table_merge (table *, char *name, char *more_val); ! void table_unset (table *, char *key); ! void table_add (table *, char *name, char *val); ! table *overlay_tables (pool *p, table *overlay, table *base); array_header *table_elts (table *); --- 145,158 ---- } table_entry; table *make_table (pool *p, int nelts); ! table *copy_table (pool *p, const table *); ! char *table_get (const table *, const char *); void table_set (table *, const char *name, const char *val); ! void table_merge (table *, const char *name, const char *more_val); ! void table_unset (table *, const char *key); ! void table_add (table *, const char *name, const char *val); ! table *overlay_tables (pool *p, const table *overlay, const table *base); array_header *table_elts (table *);