From 687c1acdbeecd7d0d7fdc4143d444e8b1563b532 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 6 Dec 2010 20:46:56 -0800 Subject: [PATCH] str: New function ss_realloc(). --- src/libpspp/str.c | 6 ++++++ src/libpspp/str.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/libpspp/str.c b/src/libpspp/str.c index 7b677225..25e2cfd5 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -341,6 +341,12 @@ ss_alloc_uninit (struct substring *new, size_t cnt) new->length = cnt; } +void +ss_realloc (struct substring *ss, size_t size) +{ + ss->string = xrealloc (ss->string, size); +} + /* Makes a pool_alloc_unaligned()'d copy of the contents of OLD in POOL, and stores it in NEW. */ void diff --git a/src/libpspp/str.h b/src/libpspp/str.h index ddfd2f82..c691f9f2 100644 --- a/src/libpspp/str.h +++ b/src/libpspp/str.h @@ -85,6 +85,7 @@ struct substring ss_tail (struct substring, size_t); struct pool; void ss_alloc_substring (struct substring *, struct substring); void ss_alloc_uninit (struct substring *, size_t); +void ss_realloc (struct substring *, size_t); void ss_alloc_substring_pool (struct substring *, struct substring, struct pool *); void ss_alloc_uninit_pool (struct substring *, size_t, struct pool *); -- 2.30.2