Skip to content

Commit

Permalink
Include stddef.h in mir-alloc.h. Use new alloc API in mir-bin-run.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
vnmakarov committed Aug 9, 2024
1 parent 6972e03 commit 2769236
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions mir-alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define MIR_ALLOC_H

#include <assert.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
Expand Down
8 changes: 5 additions & 3 deletions mir-bin-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <alloca.h>
#include <dlfcn.h>
#include <sys/stat.h>
#include "mir-alloc-default.c"
#include "mir-gen.h" // mir.h gets included as well

#define MIR_TYPE_INTERP 1
Expand Down Expand Up @@ -280,6 +281,7 @@ void open_extra_libs (void) {
}

int main (int argc, char **argv, char **envp) {
MIR_alloc_t alloc = &default_alloc;
// from binfmt_misc we expect the arguments to be:
// `mir-run /full/path/to/mir-binary mir-binary <args...>`
if (argc < 3) {
Expand All @@ -292,9 +294,9 @@ int main (int argc, char **argv, char **envp) {
MIR_val_t val;
int exit_code;

VARR_CREATE (char, temp_string, 0);
VARR_CREATE (lib_t, extra_libs, 16);
VARR_CREATE (char_ptr_t, lib_dirs, 16);
VARR_CREATE (char, temp_string, alloc, 0);
VARR_CREATE (lib_t, extra_libs, alloc, 16);
VARR_CREATE (char_ptr_t, lib_dirs, alloc, 16);
for (int i = 0; i < sizeof (std_lib_dirs) / sizeof (char_ptr_t); i++)
VARR_PUSH (char_ptr_t, lib_dirs, std_lib_dirs[i]);
lib_dirs_from_env_var ("LD_LIBRARY_PATH");
Expand Down

0 comments on commit 2769236

Please sign in to comment.