[ion] Ion::Storage is not a global variable anymore

This commit is contained in:
Romain Goyet
2018-04-10 15:05:41 +02:00
parent 5b379010d8
commit 628992680b
6 changed files with 41 additions and 27 deletions

View File

@@ -1,6 +1,7 @@
#ifndef CODE_SCRIPT_STORE_H
#define CODE_SCRIPT_STORE_H
#include <ion.h>
#include "script.h"
#include "script_template.h"
#include <python/port/port.h>
@@ -8,8 +9,6 @@ extern "C" {
#include "py/parse.h"
}
extern Ion::Storage storage;
namespace Code {
class ScriptStore : public MicroPython::ScriptProvider {
@@ -20,13 +19,13 @@ public:
ScriptStore();
Script scriptAtIndex(int index) {
return Script(storage.recordWithExtensionAtIndex(k_scriptExtension, index));
return Script(Ion::Storage::sharedStorage()->recordWithExtensionAtIndex(k_scriptExtension, index));
}
Script scriptNamed(const char * name) {
return Script(storage.recordNamed(name));
return Script(Ion::Storage::sharedStorage()->recordNamed(name));
}
int numberOfScripts() {
return storage.numberOfRecordsWithExtension(k_scriptExtension);
return Ion::Storage::sharedStorage()->numberOfRecordsWithExtension(k_scriptExtension);
}
Ion::Storage::Record::ErrorStatus addNewScript() {
return addScriptFromTemplate(ScriptTemplate::Empty());