fielding 97/04/07 03:58:41
Modified: src alloc.h alloc.c http_protocol.h http_protocol.c Log: Constify the interface to table_do in order to make it clear that the passed routine cannot change the table. Submitted by: Dean Gaudet Reviewed by: Roy Fielding Revision Changes Path 1.18 +2 -1 apache/src/alloc.h Index: alloc.h =================================================================== RCS file: /export/home/cvs/apache/src/alloc.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C3 -r1.17 -r1.18 *** alloc.h 1997/03/20 17:10:10 1.17 --- alloc.h 1997/04/07 10:58:38 1.18 *************** *** 149,155 **** 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); ! void table_do (int (*comp)(void *, char *, char *), void *rec, table *t, ...); table *overlay_tables (pool *p, const table *overlay, const table *base); --- 149,156 ---- 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); ! void table_do (int (*comp)(void *, const char *, const char *), void *rec, ! const table *t, ...); table *overlay_tables (pool *p, const table *overlay, const table *base); 1.26 +2 -1 apache/src/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C3 -r1.25 -r1.26 *** alloc.c 1997/03/22 23:51:01 1.25 --- alloc.c 1997/04/07 10:58:38 1.26 *************** *** 670,676 **** * Note that rec is simply passed-on to the comp function, so that the * caller can pass additional info for the task. */ ! void table_do (int (*comp)(void *, char *, char *), void *rec, table *t, ...) { va_list vp; char *argp; --- 670,677 ---- * Note that rec is simply passed-on to the comp function, so that the * caller can pass additional info for the task. */ ! void table_do (int (*comp)(void *, const char *, const char *), void *rec, ! const table *t, ...) { va_list vp; char *argp; 1.19 +2 -1 apache/src/http_protocol.h Index: http_protocol.h =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C3 -r1.18 -r1.19 *** http_protocol.h 1997/03/20 17:10:10 1.18 --- http_protocol.h 1997/04/07 10:58:38 1.19 *************** *** 61,67 **** /* Send a single HTTP header field */ ! int send_header_field (request_rec *r, char *fieldname, char *fieldval); /* Send the Status-Line and header fields for HTTP response */ --- 61,68 ---- /* Send a single HTTP header field */ ! int send_header_field (request_rec *r, const char *fieldname, ! const char *fieldval); /* Send the Status-Line and header fields for HTTP response */ 1.112 +6 -5 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.111 retrieving revision 1.112 diff -C3 -r1.111 -r1.112 *** http_protocol.c 1997/04/06 07:43:39 1.111 --- http_protocol.c 1997/04/07 10:58:39 1.112 *************** *** 1019,1025 **** * In other words, don't change this one without checking table_do in alloc.c. * It returns true unless there was a write error of some kind. */ ! int send_header_field (request_rec *r, char *fieldname, char *fieldval) { return (0 < bvputs(r->connection->client, fieldname, ": ", fieldval, "\015\012", NULL)); --- 1019,1026 ---- * In other words, don't change this one without checking table_do in alloc.c. * It returns true unless there was a write error of some kind. */ ! int send_header_field (request_rec *r, const char *fieldname, ! const char *fieldval) { return (0 < bvputs(r->connection->client, fieldname, ": ", fieldval, "\015\012", NULL)); *************** *** 1088,1094 **** rvputs( r, r->the_request, "\015\012", NULL ); ! table_do((int (*)(void *, char *, char *))send_header_field, (void *)r, r->headers_in, NULL); bputs("\015\012", r->connection->client); --- 1089,1095 ---- rvputs( r, r->the_request, "\015\012", NULL ); ! table_do((int (*)(void *, const char *, const char *))send_header_field, (void *)r, r->headers_in, NULL); bputs("\015\012", r->connection->client); *************** *** 1110,1116 **** table_set(r->headers_out, "Allow", make_allow(r)); set_keepalive(r); ! table_do((int (*)(void *, char *, char *))send_header_field, (void *)r, r->headers_out, NULL); bputs("\015\012", r->connection->client); --- 1111,1117 ---- table_set(r->headers_out, "Allow", make_allow(r)); set_keepalive(r); ! table_do((int (*)(void *, const char *, const char *))send_header_field, (void *)r, r->headers_out, NULL); bputs("\015\012", r->connection->client); *************** *** 1203,1209 **** /* Send the entire table of header fields, terminated by an empty line. */ ! table_do((int (*)(void *, char *, char *))send_header_field, (void *)r, r->headers_out, NULL); bputs("\015\012", r->connection->client); --- 1204,1210 ---- /* Send the entire table of header fields, terminated by an empty line. */ ! table_do((int (*)(void *, const char *, const char *))send_header_field, (void *)r, r->headers_out, NULL); bputs("\015\012", r->connection->client); *************** *** 1616,1622 **** basic_http_header(r); set_keepalive(r); ! table_do((int (*)(void *, char *, char *))send_header_field, (void *)r, r->headers_out, "Connection", "Keep-Alive", --- 1617,1623 ---- basic_http_header(r); set_keepalive(r); ! table_do((int (*)(void *, const char *, const char *))send_header_field, (void *)r, r->headers_out, "Connection", "Keep-Alive",