]> diplodocus.org Git - nmh/blobdiff - sbr/charstring.c
Use result, because (void) didn't prevent warning on FreeBSD 10.
[nmh] / sbr / charstring.c
index d94961aad604f45cce28dc70e8c1b78f9a73ae5c..00c6598652d8fe2ebef6f662be20fc98ec8bccd2 100644 (file)
@@ -42,8 +42,9 @@ charstring_reserve (charstring_t s, size_t need) {
  */
 charstring_t
 charstring_create (size_t max) {
-    charstring_t s = mh_xmalloc (sizeof *s);
+    charstring_t s;
 
+    NEW(s);
     s->max = NMH_MAX_CHARWIDTH * (max ? max : CHARSTRING_DEFAULT_SIZE);
     s->cur = s->buffer = mh_xmalloc (s->max);
     s->chars = 0;
@@ -54,8 +55,9 @@ charstring_create (size_t max) {
 charstring_t
 charstring_copy (const charstring_t src) {
     const size_t num = src->cur - src->buffer;
-    charstring_t s = mh_xmalloc (sizeof *s);
+    charstring_t s;
 
+    NEW(s);
     s->max = src->max;
     s->buffer = mh_xmalloc (s->max);
     memcpy (s->buffer, src->buffer, num);