File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ Random notes
7979 - Generally avoid assigning values to variables at declaration time,
8080 especially so for complex and/or run-time dependent values.
8181
82+ - Separate assignments from control flow. Example: Avoid the pattern
83+ if (var = func()) {...} as it complicates review and maintenance.
84+
8285 - Consistently use g_*malloc() / g_*malloc0(). Do not use standard
8386 malloc()/calloc() if it can be avoided (sometimes other libs such
8487 as libftdi can return malloc()'d memory, for example).
@@ -95,6 +98,9 @@ Random notes
9598 Do use g_try_malloc() or g_try_malloc0() for large (>= 1MB) allocations
9699 and check the return value.
97100
101+ - Endianness conversion: Prefer the common helpers that are provided in
102+ libsigrok-internal.h, such as read_u16be() etc.
103+
98104 - You should never print any messages (neither to stdout nor stderr nor
99105 elsewhere) "manually" via e.g. printf() or g_log() or similar functions.
100106 Only sr_err()/sr_warn()/sr_info()/sr_dbg()/sr_spew() should be used.
You can’t perform that action at this time.
0 commit comments