diff options
-rw-r--r-- | docs/style-guide.txt | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/docs/style-guide.txt b/docs/style-guide.txt index ee7547f28..04fa5ef97 100644 --- a/docs/style-guide.txt +++ b/docs/style-guide.txt | |||
@@ -322,7 +322,12 @@ functions, (or *maybe* macros), which are used in the code. | |||
322 | 322 | ||
323 | (in .h header file) | 323 | (in .h header file) |
324 | 324 | ||
325 | #ifndef BB_FEATURE_FUNKY | 325 | #ifdef BB_FEATURE_FUNKY |
326 | static inline void maybe_do_funky_stuff (int bar, int baz) | ||
327 | { | ||
328 | /* lotsa code in here */ | ||
329 | } | ||
330 | #else | ||
326 | static inline void maybe_do_funky_stuff (int bar, int baz) {} | 331 | static inline void maybe_do_funky_stuff (int bar, int baz) {} |
327 | #endif | 332 | #endif |
328 | 333 | ||
@@ -334,7 +339,7 @@ functions, (or *maybe* macros), which are used in the code. | |||
334 | maybe_do_funky_stuff(bar, baz); | 339 | maybe_do_funky_stuff(bar, baz); |
335 | 340 | ||
336 | The great thing about this approach is that the compiler will optimize away | 341 | The great thing about this approach is that the compiler will optimize away |
337 | the "no-op" case when the feature is turned off. | 342 | the "no-op" case (the empty function) when the feature is turned off. |
338 | 343 | ||
339 | Note also the use of the word 'maybe' in the function name to indicate | 344 | Note also the use of the word 'maybe' in the function name to indicate |
340 | conditional execution. | 345 | conditional execution. |
@@ -448,11 +453,14 @@ assigning them to a global pointer thusly: | |||
448 | 453 | ||
449 | This last approach has some advantages (low code size, space not used until | 454 | This last approach has some advantages (low code size, space not used until |
450 | it's needed), but can be a problem in some low resource machines that have | 455 | it's needed), but can be a problem in some low resource machines that have |
451 | very limited stack space (e.g., uCLinux). busybox.h declares a macro that | 456 | very limited stack space (e.g., uCLinux). |
452 | implements compile-time selection between xmalloc() and stack creation, so | 457 | |
453 | you can code the line in question as | 458 | A macro is declared in busybox.h that implements compile-time selection |
459 | between xmalloc() and stack creation, so you can code the line in question as | ||
460 | |||
454 | RESERVE_BB_BUFFER(buffer, BUFSIZ); | 461 | RESERVE_BB_BUFFER(buffer, BUFSIZ); |
455 | and the right thing will happen, based on the customer's configuration. | 462 | |
463 | and the right thing will happen, based on your configuration. | ||
456 | 464 | ||
457 | 465 | ||
458 | 466 | ||
@@ -608,8 +616,8 @@ It's considered good form to test your new feature before you submit a patch | |||
608 | to the mailing list, and especially before you commit a change to CVS. Here | 616 | to the mailing list, and especially before you commit a change to CVS. Here |
609 | are some guildlines on testing your changes. | 617 | are some guildlines on testing your changes. |
610 | 618 | ||
611 | - Always test busybox grep against GNU grep and make sure the behavior / | 619 | - Always test busybox applets against GNU counterparts and make sure the |
612 | output is identical between the two. | 620 | behavior / output is identical between the two. |
613 | 621 | ||
614 | - Try several different permutations and combinations of the features you're | 622 | - Try several different permutations and combinations of the features you're |
615 | adding and make sure they all work. (Make sure one feature does not | 623 | adding and make sure they all work. (Make sure one feature does not |