_init() and _INITIALIZER -> _make()

Gets rid of stupid memset()s and some preprocessor.
This commit is contained in:
2017-06-22 16:14:11 +02:00
parent 4a199c7b67
commit 67cc243e34
3 changed files with 25 additions and 29 deletions

View File

@@ -28,14 +28,13 @@ main (int argc, char *argv[]) {
}
int c;
struct ell_buffer buf = ELL_BUFFER_INITIALIZER;
struct ell_buffer buf = ell_buffer_make ();
while ((c = fgetc (fp)) != EOF)
ell_buffer_append_c (&buf, c);
ell_buffer_append_c (&buf, 0);
fclose (fp);
struct ell_parser p;
ell_parser_init (&p, buf.s, buf.len - 1);
struct ell_parser p = ell_parser_make (buf.s, buf.len - 1);
const char *e = NULL;
struct ell_v *program = ell_parser_run (&p, &e);
free (buf.s);
@@ -45,8 +44,7 @@ main (int argc, char *argv[]) {
}
ell_parser_free (&p);
struct ell ell;
ell_init (&ell);
struct ell ell = ell_make ();
if (!ell_std_initialize (&ell))
printf ("%s\n", "runtime library initialization failed");