aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-01-21 09:40:50 +0000
committerRon Yorston <rmy@pobox.com>2014-01-21 09:40:50 +0000
commitbaac891244b03eec99cf14a724ebcdc5877bd4e7 (patch)
treea59e8b5156e8d8eb5ea01c518e80f9173c831033 /docs
parent61a0fc571381226c48728b262495c1c5eafc4fed (diff)
parent3b394781b5b9301fc489d9bfff6fbefb4db190f3 (diff)
downloadbusybox-w32-baac891244b03eec99cf14a724ebcdc5877bd4e7.tar.gz
busybox-w32-baac891244b03eec99cf14a724ebcdc5877bd4e7.tar.bz2
busybox-w32-baac891244b03eec99cf14a724ebcdc5877bd4e7.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'docs')
-rw-r--r--docs/keep_data_small.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/keep_data_small.txt b/docs/keep_data_small.txt
index 9fc799646..3ced1a61d 100644
--- 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:
103 103
104 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); 104 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G)));
105 105
106Typically it is done in <applet>_main(). 106Typically it is done in <applet>_main(). Another variation is
107to use stack:
108
109int <applet>_main(...)
110{
111#undef G
112 struct globals G;
113 memset(&G, 0, sizeof(G));
114 SET_PTR_TO_GLOBALS(&G);
107 115
108Now you can reference "globals" by G.a, G.buf and so on, in any function. 116Now you can reference "globals" by G.a, G.buf and so on, in any function.
109 117