5 \___|\___/|_| \_\_____|
7 To Think About When Contributing Source Code
9 This document is intended to offer some guidelines that can be useful to keep
10 in mind when you decide to write a contribution to the project. This concerns
11 new features as well as corrections to existing flaws or bugs.
15 Skip over to http://curl.haxx.se/mail/ and join the appropriate mailing
16 list(s). Read up on details before you post questions. Read this file before
17 you start sending patches!
21 When contributing with code, you agree to put your changes and new code under
22 the same license curl and libcurl is already using unless stated otherwise.
24 If you add a larger piece of code, you can opt to make that file or set of
25 files to use a different license as long as they don't enforce any changes to
26 the rest of the package and they make sense. Such "separate parts" can not be
27 GPL (as we don't want the GPL virus to attack users of libcurl) but they must
28 use "GPL compatible" licenses.
32 Source code, the man pages, the INTERALS document, the TODO, the most recent
33 CHANGES. Just lurking on the libcurl mailing list is gonna give you a lot of
34 insights on what's going on right now.
38 Try using a non-confusing naming scheme for your new functions and variable
39 names. It doesn't necessarily have to mean that you should use the same as in
40 other places of the code, just that the names should be logical,
41 understandable and be named according to what they're used for. File-local
42 functions should be made static.
46 Please try using the same indenting levels and bracing method as all the
47 other code already does. It makes the source code a lot easier to follow if
48 all of it is written using the same style. We don't ask you to like it, we
49 just ask you to follow the tradition! ;-)
53 Comment your source code extensively. Commented code is quality code and
54 enables future modifications much more. Uncommented code much more risk being
55 completely replaced when someone wants to extend things, since other persons'
56 source code can get quite hard to read.
60 Keep your functions small. If they're small you avoid a lot of mistakes and
61 you don't accidentally mix up variables.
63 Non-clobbering All Over
65 When you write new functionality or fix bugs, it is important that you don't
66 fiddle all over the source files and functions. Remember that it is likely
67 that other people have done changes in the same source files as you have and
68 possibly even in the same functions. If you bring completely new
69 functionality, try writing it in a new source file. If you fix bugs, try to
70 fix one bug at a time and send them as separate patches.
72 Separate Patches Doing Different Things
74 It is annoying when you get a huge patch from someone that is said to fix 511
75 odd problems, but discussions and opinions don't agree with 510 of them - or
76 509 of them were already fixed in a different way. Then the patcher needs to
77 extract the single interesting patch from somewhere within the huge pile of
78 source, and that gives a lot of extra work. Preferably, all fixes that
79 correct different problems should be in their own patch with an attached
80 description exactly what they correct so that all patches can be selectively
81 applied by the maintainer or other interested parties.
83 Patch Against Recent Sources
85 Please try to get the latest available sources to make your patches
86 against. It makes the life of the developers so much easier. The very best is
87 if you get the most up-to-date sources from the CVS repository, but the
88 latest release archive is quite OK as well!
92 Writing docs is dead boring and one of the big problems with many open source
93 projects. Someone's gotta do it. It makes it a lot easier if you submit a
94 small description of your fix or your new features with every contribution so
95 that it can be swiftly added to the package documentation.
97 Write Access to CVS Repository
99 If you are a frequent contributor, or have another good reason, you can of
100 course get write access to the CVS repository and then you'll be able to
101 check-in all your changes straight into the CVS tree instead of sending all
102 changes by mail as patches. Just ask if this is what you'd want. You will be
103 required to have posted a few quality patches first, before you can be
104 granted write access.
108 Since the introduction of the test suite, we can quickly verify that the main
109 features are working as they're supposed to. To maintain this situation and
110 improve it, all new features and functions that are added need to be tested
111 in the test suite. Every feature that is added should get at least one valid
112 test case that verifies that it works as documented. If every submitter also
113 post a few test cases, it won't end up as a heavy burden on a single person!