Random idea...

Rob Landley rob at landley.net
Tue Feb 21 03:40:27 UTC 2006


We have lots of global variable stuff, and it's only used when one applet's 
going.

Here's a thought:

Group each applet's globals into a structure, ala:

struct APPLET_globals
{
  blah blah blah;
};

And then have a big evil union, ala:

union {
  APPLET1_globals APPLET1;
  APPLET2_globals APPLET2;
  APPLET3_globals APPLET3;
} bb_globals __attribute_(not_aliased_to_anything,really,I_mean_it);

and then have some kind of:

#define this bb_globals.APPLET

And go this.thingy;

This is assuming the compiler is smart enough to produce approximately as 
efficient code from this.thingy as just a static global thingy.  And that we 
can work out some reasonable preprocessor magic to make the above reasonable 
to do...

The upside is collapsing together all the statics so we use less runtime 
memory.

Opinions?

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list