Commit b25cfdc9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Simplify http_Teardown() a bit.

parent aadf302e
......@@ -186,16 +186,19 @@ struct http {
unsigned magic;
#define HTTP_MAGIC 0x6428b5c9
enum VSL_tag_e logtag; /* Must be SLT_*Method */
struct vsl_log *vsl;
struct ws *ws;
uint16_t shd; /* Size of hd space */
txt *hd;
unsigned char *hdf;
#define HDF_FILTER (1 << 0) /* Filtered by Connection */
#define HDF_MARKER (1 << 1) /* Marker bit */
uint16_t shd; /* Size of hd space */
/* NB: ->nhd and below zeroed/initialized by http_Teardown */
uint16_t nhd; /* Next free hd */
enum VSL_tag_e logtag; /* Must be SLT_*Method */
struct vsl_log *vsl;
struct ws *ws;
uint16_t status;
uint8_t protover;
uint8_t conds; /* If-* headers present */
......
......@@ -32,6 +32,7 @@
#include "config.h"
#include <stdio.h>
#include <stddef.h>
#include "cache.h"
......@@ -155,22 +156,13 @@ HTTP_Setup(struct http *hp, struct ws *ws, struct vsl_log *vsl,
void
http_Teardown(struct http *hp)
{
uint16_t shd;
txt *hd;
unsigned char *hdf;
/* XXX: This is not elegant, is it efficient ? */
shd = hp->shd;
hd = hp->hd;
hdf = hp->hdf;
memset(hp, 0, sizeof *hp);
memset(hd, 0, sizeof *hd * shd);
memset(hdf, 0, sizeof *hdf * shd);
hp->magic = HTTP_MAGIC;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
AN(hp->shd);
memset(&hp->nhd, 0, sizeof *hp - offsetof(struct http, nhd));
memset(hp->hd, 0, sizeof *hp->hd * hp->shd);
memset(hp->hdf, 0, sizeof *hp->hdf * hp->shd);
hp->nhd = HTTP_HDR_FIRST;
hp->shd = shd;
hp->hd = hd;
hp->hdf = hdf;
}
/*--------------------------------------------------------------------*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment