From: Ben Pfaff Date: Tue, 7 Dec 2010 04:46:56 +0000 (-0800) Subject: str: New function ss_realloc(). X-Git-Tag: v0.7.7~29 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=687c1acdbeecd7d0d7fdc4143d444e8b1563b532 str: New function ss_realloc(). --- 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 *);