|
| 1 | +CODE STYLE |
| 2 | +---------- |
| 3 | + |
| 4 | +Please use the style used by the rest of the code. Among other things, |
| 5 | +this means: |
| 6 | + |
| 7 | + * Tabs, not spaces, for indentation |
| 8 | + |
| 9 | + * Put spaces: |
| 10 | + * around binary operators |
| 11 | + * between if/while/for/switch and "(" |
| 12 | + * between function name and "(" |
| 13 | + * between ")" and "{" |
| 14 | + * after "," |
| 15 | + |
| 16 | + * if/for/while bodies: |
| 17 | + |
| 18 | + * Single-line bodies should (a) be on their own line, and (b) |
| 19 | + not have braces around them |
| 20 | + |
| 21 | + * Multi-line bodies should have braces around them, even if |
| 22 | + the body is only a single statement and the braces are not |
| 23 | + syntactically necessary. |
| 24 | + |
| 25 | + * Eg: |
| 26 | + |
| 27 | + for (i = 0; i < len; i++) { |
| 28 | + if (find (i, something)) |
| 29 | + break; |
| 30 | + else { |
| 31 | + function_with_big_name (i, something, |
| 32 | + something_else); |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + * C89, not C99. (In particular, don't declare variables in the |
| 37 | + middle of blocks.) |
| 38 | + |
| 39 | + * Do not use gint, gchar, glong, and gshort. (Other g-types, such |
| 40 | + as gpointer and the unsigned types are fine.) |
| 41 | + |
| 42 | +CORRECTNESS |
| 43 | +----------- |
| 44 | + |
| 45 | + * libsoup builds with lots of -W options by default, and should |
| 46 | + not print any warnings while compiling (unless they're caused by |
| 47 | + #included files from other projects, eg, proxy.h). You can use |
| 48 | + "make > /dev/null" to do a full compile showing only the |
| 49 | + warnings/errors, to make sure your patch does not introduce any |
| 50 | + more. |
| 51 | + |
| 52 | + * There are a number of regression tests in the tests/ directory. |
| 53 | + Running "make check" will run all of them (or at least, all of |
| 54 | + the ones that it can run based on what software you have |
| 55 | + installed. Eg, some tests require apache to be installed.) You |
| 56 | + should run "make check" before submitting a patch that could |
| 57 | + potentially change libsoup's behavior. ("make check" will warn |
| 58 | + you if it was not able to run all of the tests. If you are |
| 59 | + making extensive changes, or changing very low-level functions, |
| 60 | + you may want to install all of the optional pieces so you can |
| 61 | + run all of the regression tests.) |
| 62 | + |
| 63 | + * libsoup ought to build correctly from outside its source tree, |
| 64 | + so if you make large changes to the Makefiles, try a "make |
| 65 | + distcheck" to verify that an out-of-source-tree build still |
| 66 | + works. |
0 commit comments