Skip to content

Instantly share code, notes, and snippets.

@aji
Created April 13, 2012 19:20
Show Gist options
  • Save aji/2379374 to your computer and use it in GitHub Desktop.
Save aji/2379374 to your computer and use it in GitHub Desktop.
diff --git a/src/libmowgli/core/mowgli_string.c b/src/libmowgli/core/mowgli_string.c
index 0aa065a..c37a851 100644
--- a/src/libmowgli/core/mowgli_string.c
+++ b/src/libmowgli/core/mowgli_string.c
@@ -24,11 +24,11 @@
#include "mowgli.h"
-mowgli_string_t *mowgli_string_create(void)
+mowgli_string_t *mowgli_string_create_size(size_t n)
{
mowgli_string_t *self = mowgli_alloc(sizeof(mowgli_string_t));
- self->size = 64;
+ self->size = n;
self->pos = 0;
self->str = mowgli_alloc(self->size);
@@ -40,6 +40,11 @@ mowgli_string_t *mowgli_string_create(void)
return self;
}
+mowgli_string_t *mowgli_string_create(void)
+{
+ return mowgli_string_create_size(64);
+}
+
void mowgli_string_reset(mowgli_string_t *self)
{
return_if_fail(self != NULL);
diff --git a/src/libmowgli/core/mowgli_string.h b/src/libmowgli/core/mowgli_string.h
index 9a4cbab..a1ffa78 100644
--- a/src/libmowgli/core/mowgli_string.h
+++ b/src/libmowgli/core/mowgli_string.h
@@ -36,6 +36,7 @@ typedef struct mowgli_string_ {
void (*destroy)(struct mowgli_string_ *self);
} mowgli_string_t;
+extern mowgli_string_t *mowgli_string_create_size(size_t n);
extern mowgli_string_t *mowgli_string_create(void);
extern void mowgli_string_reset(mowgli_string_t *self);
extern void mowgli_string_destroy(mowgli_string_t *self);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment