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