mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
Updated the declaration regarding g_try_malloc().
This commit is contained in:
parent
fcc3c01926
commit
734e9935d2
@ -41,8 +41,8 @@ Random notes
|
||||
- Generally avoid assigning values to variables at declaration time,
|
||||
especially so for complex and/or run-time dependent values.
|
||||
|
||||
- Consistently use g_*malloc() / g_*malloc0(). Do not use standard
|
||||
g_try_malloc0()/calloc() if it can be avoided (sometimes other libs such
|
||||
- Consistently use g_try_malloc0() / g_try_malloc(). Do not use standard
|
||||
malloc() if it can be avoided (sometimes other libs such
|
||||
as libftdi can return g_try_malloc0()'d memory, for example).
|
||||
|
||||
- Always properly match allocations with the proper *free() functions. If
|
||||
@ -50,11 +50,11 @@ Random notes
|
||||
memory. Otherwise use standard g_free(). Never use the wrong function!
|
||||
|
||||
- We assume that "small" memory allocations (< 1MB) will always succeed.
|
||||
Thus, it's fine to use g_try_malloc0() or g_try_malloc0() for allocations of
|
||||
simple/small structs and such (instead of using g_try_malloc0()), and
|
||||
Thus, it's fine to use g_try_malloc0() or g_try_malloc() for allocations of
|
||||
simple/small structs and such (instead of using malloc()), and
|
||||
there's no need to check the return value.
|
||||
|
||||
Do use g_try_malloc0() or g_try_malloc0() for large (>= 1MB) allocations
|
||||
Do use g_try_malloc0() or g_try_malloc() for large (>= 1MB) allocations
|
||||
and check the return value.
|
||||
|
||||
- You should never print any messages (neither to stdout nor stderr nor
|
||||
|
Loading…
x
Reference in New Issue
Block a user