py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.
Now there is just one function to allocate a new vstr, namely vstr_new
(in addition to vstr_init etc). The caller of this function should know
what initial size to allocate for the buffer, or at least have some policy
or config option, instead of leaving it to a default (as it was before).
diff --git a/py/vstr.c b/py/vstr.c
index 5096475..6a91552 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -74,20 +74,8 @@
vstr->buf = NULL;
}
-vstr_t *vstr_new(void) {
+vstr_t *vstr_new(size_t alloc) {
vstr_t *vstr = m_new_obj(vstr_t);
- if (vstr == NULL) {
- return NULL;
- }
- vstr_init(vstr, 16);
- return vstr;
-}
-
-vstr_t *vstr_new_size(size_t alloc) {
- vstr_t *vstr = m_new_obj(vstr_t);
- if (vstr == NULL) {
- return NULL;
- }
vstr_init(vstr, alloc);
return vstr;
}