CONTRIBUTING.md: update init/finish description

master
Kirill Primak 3 years ago
parent a1e1e9aba8
commit ec2af17674

@ -167,7 +167,6 @@ if (condition1 && condition2 && ...
Try to break the line in the place which you think is the most appropriate.
### Line Length
Try to keep your lines under 80 columns, but you can go up to 100 if it
@ -190,16 +189,18 @@ Functions that are responsible for constructing objects should take one of the
two following forms:
* `init`: for functions which accept a pointer to a pre-allocated object (e.g.
a member of a struct) and initialize it.
a member of a struct) and initialize it. Such functions must call `memset()`
to zero out the memory before initializing it to avoid leaving unset fields.
* `create`: for functions which allocate the memory for an object, initialize
it, and return a pointer.
it, and return a pointer. Such functions should allocate the memory with
`calloc()` to avoid leaving unset fields.
Likewise, functions that are responsible for destructing objects should take
one of the two following forms:
* `finish`: for functions which accept a pointer to an object and deinitialize
it. Such functions should always be able to accept an already deinitialized
object.
it. If a finished object isn't destroyed but kept for future use, it must be
reinitialized to be used again.
* `destroy`: for functions which accept a pointer to an object, deinitialize
it, and free the memory. Such functions should always be able to accept a NULL
pointer.

Loading…
Cancel
Save