-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# CONTRIBUTING | ||
|
||
Any contributions (code, documentation, ...) are welcome. This project uses [cmocka](http://cmocka.org) for testing, you may need to check their documentation | ||
|
||
# New Features | ||
- This library may not accept all new features, it is better to create an issue and get approval before coding | ||
- You must add test for every new feature | ||
- The feature must be compiled in both UNIX/POSIX systems (e.g. macos, linux...) and Windows | ||
|
||
# Code Style | ||
This library is written with C99, don't try to add C++ files (yes it can compiled into lib), | ||
if you have enough reason to add C++ files than create an issue and get approval before coding, | ||
|
||
- Lines should be wrapped at 80 characters. | ||
- Don't invent new style for existing ones | ||
- Use C89 style comments (`/* comments */`) not C++ style comments (`// comments`) | ||
- Don't use TABs instead use 2 spaces for TABs | ||
- All indents must be 2 spaces, not 1 nor 4 space | ||
- All functions in `include` folder must be exported by `DS_EXPORT` and wrapped by `extern "C" {` for C++ | ||
- Crate new line for return type, attribs: | ||
|
||
```C | ||
DS_EXPORT | ||
uint32_t | ||
ds_hashfn_djb2(void *key); | ||
``` | ||
not acceptable: | ||
```C | ||
DS_EXPORT uint32_t ds_hashfn_djb2(void *key); | ||
``` | ||
- Variables must be declared at the top of a scope before usage: | ||
```C | ||
int x; | ||
int y; | ||
|
||
x = y = 0; | ||
``` | ||
|
||
not acceptable: | ||
|
||
```C | ||
int x; | ||
|
||
x = 0; | ||
int y = 0; | ||
``` | ||
|
||
- All files must retain same LICENSE statement | ||
- Code with warnings will not be accepted, please suppress them (not by disabling them) | ||
- Run code anaylysis before submitting pull requests, if you use Xcode you can enable Sanitizer in scheme, you can use valgrind in linux |