From 2667b8a074454004900d6925e26b043ddd9be5cb Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 4 Jan 2017 16:52:38 +0100 Subject: [PATCH] Keyboardio: Change from static to extern We want the `Keyboardio` object to be a singleton. If it is static, then each library that gets compiled separately, and uses it in one way or the other, will have a copy of it. Making it extern, we'll only have one copy, as it should be. I don't think there were any bugs caused by it being static, but it was certainly a tiny bit of wasted code and memory. Signed-off-by: Gergely Nagy --- src/KeyboardioFirmware.cpp | 2 ++ src/KeyboardioFirmware.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/KeyboardioFirmware.cpp b/src/KeyboardioFirmware.cpp index b72c2cdd..3fe8da1a 100644 --- a/src/KeyboardioFirmware.cpp +++ b/src/KeyboardioFirmware.cpp @@ -53,3 +53,5 @@ Keyboardio_::use(KeyboardioPlugin *plugin, ...) { }; va_end(ap); } + +Keyboardio_ Keyboardio; diff --git a/src/KeyboardioFirmware.h b/src/KeyboardioFirmware.h index bab6dd12..b6bc6654 100644 --- a/src/KeyboardioFirmware.h +++ b/src/KeyboardioFirmware.h @@ -43,4 +43,4 @@ class Keyboardio_ { void use(KeyboardioPlugin *plugin, ...) __attribute__((sentinel)); }; -static Keyboardio_ Keyboardio; +extern Keyboardio_ Keyboardio;