Simplify aos::Init
Most of the variants were to deal with core, which has been gone for a
year. Simplify those all into InitGoogle.
InitGoogle should be renamed to Init at some point. It does everything
now.
Change-Id: I738ee03e9c5b2e6348ef33302835f915df68011f
diff --git a/frc971/analysis/py_log_reader.cc b/frc971/analysis/py_log_reader.cc
index e8843a9..8d3e2a6 100644
--- a/frc971/analysis/py_log_reader.cc
+++ b/frc971/analysis/py_log_reader.cc
@@ -13,11 +13,13 @@
#include <Python.h>
#include <memory>
+#include <errno.h>
#include "aos/configuration.h"
#include "aos/events/logging/logger.h"
#include "aos/events/simulated_event_loop.h"
#include "aos/flatbuffer_merge.h"
+#include "aos/init.h"
#include "aos/json_to_flatbuffer.h"
namespace frc971 {
@@ -75,6 +77,15 @@
}
int LogReader_init(LogReaderType *self, PyObject *args, PyObject *kwds) {
+ int count = 1;
+ if (!aos::IsInitialized()) {
+ // Fake out argc and argv to let InitGoogle run properly to instrument
+ // malloc, setup glog, and such.
+ char *name = program_invocation_name;
+ char **argv = &name;
+ aos::InitGoogle(&count, &argv);
+ }
+
const char *kwlist[] = {"log_file_name", nullptr};
const char *log_file_name;