From 40c07f3e04410064def98325815aaaf4908f0844 Mon Sep 17 00:00:00 2001 From: hniksic Date: Tue, 21 Jun 2005 18:45:08 -0700 Subject: [PATCH] [svn] Use bitfields for booleans in struct cookie to save space. --- src/ChangeLog | 6 ++++++ src/cookies.c | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 995a9a46..f6a844f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-06-22 Hrvoje Niksic + + * cookies.c (struct cookie): Use 1-bit bitfields for booleans + which makes the structure takes less space at no cost in + complexity. + 2005-06-22 Hrvoje Niksic * Makefile.in ($(OBJ)): Add the config.h dependency. diff --git a/src/cookies.c b/src/cookies.c index 0b690c66..2addd185 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -98,21 +98,21 @@ struct cookie { int port; /* port number */ char *path; /* path prefix of the cookie */ - int secure; /* whether cookie should be + unsigned discard_requested :1; /* whether cookie was created to + request discarding another + cookie. */ + + unsigned secure :1; /* whether cookie should be transmitted over non-https connections. */ - int domain_exact; /* whether DOMAIN must match as a + unsigned domain_exact :1; /* whether DOMAIN must match as a whole. */ - int permanent; /* whether the cookie should outlive + int permanent :1; /* whether the cookie should outlive the session. */ time_t expiry_time; /* time when the cookie expires, 0 means undetermined. */ - int discard_requested; /* whether cookie was created to - request discarding another - cookie. */ - char *attr; /* cookie attribute name */ char *value; /* cookie attribute value */ -- 2.39.2