projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f592d7
)
docs: tweak keep_data_small.txt
author
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 13 Jan 2014 10:45:34 +0000
(11:45 +0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 13 Jan 2014 10:45:34 +0000
(11:45 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
docs/keep_data_small.txt
patch
|
blob
|
history
diff --git
a/docs/keep_data_small.txt
b/docs/keep_data_small.txt
index 9fc799646a3ad44a3fcf011d2662a377746c4463..3ced1a61da0dbdbab1f68abec7fad6d982adb1a2 100644
(file)
--- a/
docs/keep_data_small.txt
+++ b/
docs/keep_data_small.txt
@@
-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.