summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/astring.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-01-08 17:18:54 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-01-08 17:18:54 +0000
commita92de5930cef847ffdafd1e6c8e9f2bf03375c39 (patch)
treee8e5887dfcf861cc77ed1675015267450fc6fc8a /src/lib/util/astring.c
parenta0a40f8815e5c16bd2ab8ee333d19bcfe1e6ee55 (diff)
Extended the astring class wrapper into something useful, and
useable as a stack object. Also designed the interfaces to allow for chaining operations. And added a casting operator to const char * for seamless use in most functions that take plain old C strings. Changed all uses of astring to use the object directly on the stack or embedded in objects instead of explicitly allocating and deallocating it. Removed a lot of annoying memory management code as a result. Changed interfaces that accepted/returned an astring * to use an astring & instead. Removed auto_alloc_astring(machine). Use auto_alloc(machine, astring) instead.
Diffstat (limited to 'src/lib/util/astring.c')
-rw-r--r--src/lib/util/astring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/util/astring.c b/src/lib/util/astring.c
index 7ce911dfa30..6ccda117905 100644
--- a/src/lib/util/astring.c
+++ b/src/lib/util/astring.c
@@ -138,15 +138,15 @@ INLINE void normalize_substr(int *start, int *count, int length)
#ifdef __cplusplus
/*-------------------------------------------------
- astring - basic constructor
+ init - constructor helper
-------------------------------------------------*/
-astring::astring()
+astring &astring::init()
{
- /* initialize base fields by hand */
text = smallbuf;
alloclen = ARRAY_LENGTH(smallbuf);
smallbuf[0] = 0;
+ return *this;
}