summaryrefslogtreecommitdiff
path: root/intl
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2009-02-23 18:07:50 +0100
committerTheodore Ts'o <tytso@mit.edu>2009-03-08 20:37:12 -0400
commit45e338f5332a54295893dba2e32cc093d1316f60 (patch)
treef20a569662c01e9330b33ea9fd8baa83c7601473 /intl
parenta6d4aa147415acf875300176c5ca98ca72594bec (diff)
remove useless if-before-free tests
In case you're wondering about whether this change is safe from a portability standpoint, fear not. This has been beaten to death in other forums. Here are a few threads: http://thread.gmane.org/gmane.comp.version-control.git/74187 http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712 http://thread.gmane.org/gmane.emacs.devel/98144 http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092 There has been debate about whether it's a good idea from a performance standpoint, too, but imho you'll have a hard time finding an instance where this sort of change induces a measurable performance penalty. If you do, please let me know. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'intl')
-rw-r--r--intl/bindtextdom.c3
-rw-r--r--intl/loadmsgcat.c6
-rw-r--r--intl/localcharset.c3
-rw-r--r--intl/printf-parse.c6
-rw-r--r--intl/vasnprintf.c9
5 files changed, 9 insertions, 18 deletions
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index dcdc4008..82842265 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -197,8 +197,7 @@ set_binding_values (const char *domainname,
if (__builtin_expect (result != NULL, 1))
{
- if (binding->codeset != NULL)
- free (binding->codeset);
+ free (binding->codeset);
binding->codeset = result;
binding->codeset_cntr++;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index c8fc46d2..7fab71a3 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -1372,8 +1372,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
/* This is an invalid revision. */
invalid:
/* This is an invalid .mo file. */
- if (domain->malloced)
- free (domain->malloced);
+ free (domain->malloced);
#ifdef HAVE_MMAP
if (use_mmap)
munmap ((void *) data, size);
@@ -1405,8 +1404,7 @@ _nl_unload_domain (struct loaded_domain *domain)
_nl_free_domain_conv (domain);
- if (domain->malloced)
- free (domain->malloced);
+ free (domain->malloced);
# ifdef _POSIX_MAPPED_FILES
if (domain->use_mmap)
diff --git a/intl/localcharset.c b/intl/localcharset.c
index 4865f103..a3e3a9b8 100644
--- a/intl/localcharset.c
+++ b/intl/localcharset.c
@@ -199,8 +199,7 @@ get_charset_aliases ()
}
}
- if (file_name != NULL)
- free (file_name);
+ free (file_name);
#else
diff --git a/intl/printf-parse.c b/intl/printf-parse.c
index d19f903d..416dedaa 100644
--- a/intl/printf-parse.c
+++ b/intl/printf-parse.c
@@ -524,10 +524,8 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
return 0;
error:
- if (a->arg)
- free (a->arg);
- if (d->dir)
- free (d->dir);
+ free (a->arg);
+ free (d->dir);
return -1;
}
diff --git a/intl/vasnprintf.c b/intl/vasnprintf.c
index 8a62282d..61bfb9e1 100644
--- a/intl/vasnprintf.c
+++ b/intl/vasnprintf.c
@@ -801,8 +801,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
{
if (!(result == resultbuf || result == NULL))
free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
+ free (buf_malloced);
CLEANUP ();
errno = EINVAL;
return NULL;
@@ -860,8 +859,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
result = memory;
}
- if (buf_malloced != NULL)
- free (buf_malloced);
+ free (buf_malloced);
CLEANUP ();
*lengthp = length;
return result;
@@ -869,8 +867,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
out_of_memory:
if (!(result == resultbuf || result == NULL))
free (result);
- if (buf_malloced != NULL)
- free (buf_malloced);
+ free (buf_malloced);
out_of_memory_1:
CLEANUP ();
errno = ENOMEM;