1
1

* HACKING (Programming tips): added a tip concerning the NULL

pointer in varargs function calls.
Этот коммит содержится в:
Roland Illig 2004-09-24 15:14:05 +00:00
родитель 4bc786735e
Коммит 844d55b627

Просмотреть файл

@ -311,6 +311,8 @@ Programming Tips
(This list should be sorted alphabetically.)
catstrs: (see NULL).
const: For every function taking a string argument, decide whether you
(as a user of the function) would expect that the string is modi-
fied by the function. If not, declare the string argument as
@ -325,12 +327,16 @@ const_cast: We use many libraries that do not know about "const char *" and
function does with the string, we should use g_strdup to pass
dynamically allocated strings.
execl, execle, execlp: (see NULL).
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);
g_strconcat: (see NULL).
g_strdup: When you use g_strdup to create a local copy of a string, use
the following pattern to keep the reference.