]> git.earman.xyz Git - sensor-watch.git/commitdiff
faces/totp: define TOTP data array size function
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 21 Feb 2024 02:16:41 +0000 (23:16 -0300)
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 21 Feb 2024 02:16:41 +0000 (23:16 -0300)
Computes the size of the array of TOTP records.
The compiler will likely evaluate it at compile time.

movement/watch_faces/complication/totp_face.c

index dcdc957d95527680df11c15394eef103262c2611..4ab77c373b1a13f376ac6771eaa7c0cc7fc4ff42 100644 (file)
@@ -65,6 +65,10 @@ static totp_t totp_data[] = {
 // END OF KEY DATA.
 ////////////////////////////////////////////////////////////////////////////////
 
+static inline size_t _totp_num(void) {
+    return sizeof(totp_data) / sizeof(*totp_data);
+}
+
 static void _update_display(totp_state_t *totp_state) {
     char buf[14];
     div_t result;