← Commit list

d74f8435e

Denys Vlasenko
Denys Vlasenko
2014-01-13
SUCCESS Duration: 127s

Subject

docs: tweak keep_data_small.txt

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

docs/keep_data_small.txt+9 -1
@@ -103,7 +103,15 @@ smaller code. In order to assign it, use SET_PTR_TO_GLOBALS macro:
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G)));
-Typically it is done in <applet>_main().
+Typically it is done in <applet>_main(). Another variation is
+to use stack:
+
+int <applet>_main(...)
+{
+#undef G
+ struct globals G;
+ memset(&G, 0, sizeof(G));
+ SET_PTR_TO_GLOBALS(&G);
Now you can reference "globals" by G.a, G.buf and so on, in any function.