Skip to content

Commit

Permalink
HACKING: Add subtleties.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZmnSCPxj authored and cdecker committed Feb 3, 2018
1 parent 5f2cd7c commit 4255e41
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion doc/HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ valgrind installed, and build with DEVELOPER=1 (currently the default).
header order, and checks formatted quotes from BOLTs if BOLTDIR
exists (currently disabled, since BOLTs are being re-edited).

* unit tests - run by `make check`, these are run-*.c files in test/
* unit tests - run by `make check`, these are `run-*.c` files in test/
subdirectories which can test routines inside C source files. You
should insert `/* AUTOGENERATED MOCKS START */` and `/* AUTOGENERATED MOCKS END */`
lines, and `make update-mocks` will automatically generate stub functions
Expand All @@ -169,6 +169,25 @@ valgrind installed, and build with DEVELOPER=1 (currently the default).

Our Travis CI instance (see `.travis.yml`) runs all these for each pull request.

Subtleties
----------

There are a few subtleties you should be aware of as you modify deeper parts
of the code:

* `structeq` will not work on some structures.
For example, it will not work with `struct short_channel_id` --- use
`short_channel_id_eq` for comparing those.
* `command_success`, `command_fail`, and `command_fail_detailed` will free the
`cmd` you pass in.
This also means that if you `tal`-allocated anything from the `cmd`, they
will also get freed at those points and will no longer be accessible
afterwards.
* When making a structure part of a list, you will instance a
`struct list_node`.
This has to be the *first* field of the structure, or else `dev-memleak`
command will think your structure has leaked.

Further Information
-------------------

Expand Down

0 comments on commit 4255e41

Please sign in to comment.