summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-03-06 15:48:04 +1100
committerJon Loeliger <jdl@loeliger.com>2008-03-23 08:00:33 -0500
commit1a9468c9a0c0bd6e3ff1b9bff7547dd7e7aa9bb7 (patch)
tree08a1a379f1a6f57c11826077c0cacc0bf16662c9
parent8a88ad8badfe54d91b35c5da25889de0db54f43e (diff)
downloaddtc-1a9468c9a0c0bd6e3ff1b9bff7547dd7e7aa9bb7.tar.gz
dtc: Abolish asize field of struct data
The asize field in struct data is a hangover from the early days when a struct data was sometimes allowed to refer to a static chunk of memory rather than a malloc()ed block. That's long gone, since the lifetime issues were far more trouble than it was worth, so get rid of the asize field. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--data.c8
-rw-r--r--dtc.h1
2 files changed, 0 insertions, 9 deletions
diff --git a/data.c b/data.c
index a94718c..0ee1010 100644
--- a/data.c
+++ b/data.c
@@ -32,8 +32,6 @@ void data_free(struct data d)
m = nm;
}
- assert(!d.val || d.asize);
-
if (d.val)
free(d.val);
}
@@ -43,9 +41,6 @@ struct data data_grow_for(struct data d, int xlen)
struct data nd;
int newsize;
- /* we must start with an allocated datum */
- assert(!d.val || d.asize);
-
if (xlen == 0)
return d;
@@ -56,11 +51,8 @@ struct data data_grow_for(struct data d, int xlen)
while ((d.len + xlen) > newsize)
newsize *= 2;
- nd.asize = newsize;
nd.val = xrealloc(d.val, newsize);
- assert(nd.asize >= (d.len + xlen));
-
return nd;
}
diff --git a/dtc.h b/dtc.h
index dbff5e8..d5be1a5 100644
--- a/dtc.h
+++ b/dtc.h
@@ -118,7 +118,6 @@ struct marker {
struct data {
int len;
char *val;
- int asize;
struct marker *markers;
};