diff --git a/ChangeLog b/ChangeLog index 26a8fad97..262763f85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-09-04 Pavel S. Shirshov + + * HACKING: Add to section "Programming Tips" g_free tip. + 2004-09-02 Roland Illig * HACKING: Added a section "Programming Tips" which lists mistakes diff --git a/HACKING b/HACKING index 50085cbd1..a2d31da85 100644 --- a/HACKING +++ b/HACKING @@ -296,3 +296,9 @@ size_t: This data type is suitable for expressing sizes of memory or the strncpy: Don't use this function in newly created code. It is slow, insecure and hard to use. A much better alternative is g_strlcpy (see there). + +g_free: g_free handles NULL argument too, no need for the comparison. + Bad way: + if (old_dir) g_free (old_dir); + Right way: + g_free (old_dir);