blob: f31b1a87521204d1a2da0286421c217e98cb04ce [file] [log] [blame]
Robert Hak465ba3e2002-08-21 10:29:58 +00001 __________ __ ___.
2 Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 \/ \/ \/ \/ \/
7 Contribution Policies
8
9
Robert Hak40bafc52002-08-21 10:19:23 +000010In order for the project to run as smoothly as possible, it's best if all
Daniel Stenberge248eac2006-03-03 07:31:54 +000011contributors adhere to a few simple source code conventions:
12
13Exceptions
14----------
15This project borrows and imports quite a lot of code from other free software
16projects. We do not change style of such code unless we really have to, even
17though they might be using style very different from others.
Robert Hak40bafc52002-08-21 10:19:23 +000018
19Language
20--------
21Write all code in C. Sometimes assembly is faster, but C is always more
22readable and maintainable.
23
24Language features
25-----------------
Björn Stenbergff8e9d92009-10-23 07:26:48 +000026Write normal C code. Keep it simple. Don't redefine the language. No new types
27(structs are structs, not typedefs). No C++isms or Javaisms. No code in .h
28files or #defines.
Robert Hak40bafc52002-08-21 10:19:23 +000029
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000030Identifiers
Frank Gevaertsb411f5e2009-02-12 20:49:53 +000031-----------
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000032We do not want mixed case identifiers.
Robert Hak40bafc52002-08-21 10:19:23 +000033Variables and function names should be all lower case.
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000034Struct and enum names should be all lower case.
35Preprocessor symbols and enum constants should be all upper case.
Robert Hak40bafc52002-08-21 10:19:23 +000036
Daniel Stenberg071898e2003-03-04 15:06:53 +000037Comments
38--------
39We only use plain old /* C standard comments */.
Tomas Salfischbergerabf975d2006-02-27 15:01:34 +000040If you want to comment out large blocks containing other comments, use #if 0.
Daniel Stenberg071898e2003-03-04 15:06:53 +000041
Robert Hak40bafc52002-08-21 10:19:23 +000042Style
43-----
44When changing code, follow the code style of the file you are editing.
45
46When writing new files, you may use the brace placement style of your choice.
47
Daniel Stenberg8e757342007-09-06 11:08:23 +000048Braces for function declarations are put in a new line under the name, as in:
49
50 int foo(char *name)
51 {
52 return FOO_NAME:
53 }
54
Robert Hak40bafc52002-08-21 10:19:23 +000055Always indent your code with four spaces. Don't use TAB characters, as that
Marcin Bukatfee6f802012-01-24 13:05:25 +010056will mess up code display, printing, and a zillion other places.
Robert Hak40bafc52002-08-21 10:19:23 +000057
58Keep lines below 80 columns length. Use whitespace and newlines to make the
59code easy to browse/read.
60
61Text format
62-----------
63Use "unix style" line feeds: "LF" only. Do not use "CR+LF".
64
Nicolas Pennequin357ffb32008-05-05 10:32:46 +000065Use UTF-8 character set, but try to refrain from using any non-ascii
Daniel Stenberg95cde0b2005-10-28 10:44:50 +000066letters as they will only appear weird in some camps no matter what.
67
Marcin Bukatfee6f802012-01-24 13:05:25 +010068Contributing code
Robert Hak40bafc52002-08-21 10:19:23 +000069-------
Marcin Bukatfee6f802012-01-24 13:05:25 +010070We have a public code review system based on git, which is also how you can
71check out the latest version of the Rockbox sources.
72See http://www.rockbox.org/wiki/UsingGit for details on how to setup your
73environment and how to upload a change you have made for review.
Robert Hak40bafc52002-08-21 10:19:23 +000074
Marcin Bukatfee6f802012-01-24 13:05:25 +010075We'd prefer that you don't submit patches to the bug tracker any more,
76as it's much harder to read and discuss them there.
Björn Stenberg4a67c872006-03-09 14:58:15 +000077
78Credits
79-------
80We believe in crediting all contributors by name. Before committing a patch to
Marcin Bukatfee6f802012-01-24 13:05:25 +010081Git, we ask that you give us your full real name (no pseudonyms or nicknames)
Björn Stenberg4a67c872006-03-09 14:58:15 +000082for adding to the credits list.