This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository eshell.
View the commit online.
commit 4494f8d459dd69032a9365a93f95ee26e0b49bfa
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Sun Nov 10 18:01:11 2024 -0500
Cleanup
---
escript/include/escript.h | 6 +++++-
escript/include/lexer.h | 1 +
escript/src/escript.c | 9 ++++++++-
escript/src/lexer.c | 5 +++++
eshell/src/eshell.c | 8 +++++++-
eshell/src/eshell.h | 4 +++-
6 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/escript/include/escript.h b/escript/include/escript.h
index 63c4dd1..64ed043 100644
--- a/escript/include/escript.h
+++ b/escript/include/escript.h
@@ -13,6 +13,10 @@ struct Escript
struct Escript_Lexer* lex;
};
-int escript_init(struct Escript* env, int argc, char** argv);
+typedef struct Escript Escript;
+
+// TODO _new
+int escript_init(Escript* env, int argc, char** argv);
+void escript_cleanup(Escript* env);
#endif
diff --git a/escript/include/lexer.h b/escript/include/lexer.h
index 9605718..c1ff814 100644
--- a/escript/include/lexer.h
+++ b/escript/include/lexer.h
@@ -22,5 +22,6 @@ struct Escript_Lexer
int escript_lexer_init(struct Escript_Lexer* lex);
int escript_lexer_lex(struct Escript_Lexer* lex, char const* string, size_t string_len);
+void escript_lexer_cleanup(struct Escript_Lexer* lex);
#endif
diff --git a/escript/src/escript.c b/escript/src/escript.c
index 8609f74..46d7d98 100644
--- a/escript/src/escript.c
+++ b/escript/src/escript.c
@@ -10,9 +10,16 @@
#include "escript.h"
#include "lexer.h"
-int escript_init(struct Escript* escript, int argc, char** argv)
+int escript_init(Escript* escript, int argc, char** argv)
{
escript->lex = malloc(sizeof(struct Escript_Lexer)); // TODO free me
escript_lexer_init(escript->lex);
return 0;
}
+
+void escript_cleanup(Escript* escript)
+{
+ escript_lexer_cleanup(escript->lex);
+ free(escript->lex);
+}
+
diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index 387c845..73536c5 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -18,3 +18,8 @@ escript_lexer_lex(struct Escript_Lexer* lex, char const* string, size_t string_l
{
puts(string);
}
+
+void
+escript_lexer_cleanup(struct Escript_Lexer* cleanup)
+{
+}
diff --git a/eshell/src/eshell.c b/eshell/src/eshell.c
index 090e4f4..0735dc7 100644
--- a/eshell/src/eshell.c
+++ b/eshell/src/eshell.c
@@ -12,11 +12,17 @@
int eshell_init(struct Eshell* eshell, int argc, char** argv)
{
- eshell->escript = malloc(sizeof(struct Escript)); // TODO clean me
+ eshell->escript = malloc(sizeof(Escript)); // TODO clean me
escript_init(eshell->escript, argc, argv);
return 0;
}
+int eshell_cleanup(struct Eshell* eshell)
+{
+ escript_cleanup(eshell->escript);
+ free(eshell->escript);
+}
+
int eshell_io_loop(struct Eshell* eshell)
{
char in[512] = {0};
diff --git a/eshell/src/eshell.h b/eshell/src/eshell.h
index 5903ddc..b349f09 100644
--- a/eshell/src/eshell.h
+++ b/eshell/src/eshell.h
@@ -5,9 +5,11 @@
#ifndef ESHELL_ESHELL_H
#define ESHELL_ESHELL_H
+#include "escript.h"
+
struct Eshell
{
- struct Escript* escript;
+ Escript* escript;
char* prompt;
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.