Simon Josefsson wrote: > Make syntax-check complains about this in localcharset.c: > > if (old_res_ptr != NULL) > free (old_res_ptr); > > maint.mk: found useless "if" before "free" above
I wouldn't use this rule in general, because whether the 'if' is appropriate depends on the situation. But in this place the code is not speed critical at all, so removing the 'if' is fine. I've done it: 2011-02-28 Bruno Haible <[email protected]> localcharset: Assume ANSI C behaviour of free(). * lib/localcharset.c (get_charset_aliases): Remove NULL test before calling free(). Suggested by Simon Josefsson <[email protected]>. --- lib/localcharset.c.orig Mon Feb 28 23:37:47 2011 +++ lib/localcharset.c Mon Feb 28 23:36:30 2011 @@ -228,8 +228,7 @@ { /* Out of memory. */ res_size = 0; - if (old_res_ptr != NULL) - free (old_res_ptr); + free (old_res_ptr); break; } strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); -- In memoriam Olof Palme <http://en.wikipedia.org/wiki/Olof_Palme>
