changeset 2338:3dfb80bf846b

("path-concat.h"): Include. (get_charset_aliases): Use path_concat instead of ANSI string concatenation.
author Jim Meyering <jim@meyering.net>
date Sun, 05 Mar 2000 10:27:22 +0000
parents 6247100eb33e
children d7b231a64bc0
files lib/localcharset.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -45,6 +45,8 @@
 # endif
 #endif
 
+#include "path-concat.h"
+
 char *xmalloc ();
 char *xrealloc ();
 
@@ -69,10 +71,10 @@
   if (cp == NULL)
     {
       FILE *fp;
+      char *file_name = path_concat (LIBDIR, "charset.alias", NULL);
 
-      fp = fopen (LIBDIR "/" "charset.alias", "r");
-      if (fp == NULL)
-	/* File not found, treat it as empty.  */
+      if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
+	/* Out of memory or file not found, treat it as empty.  */
 	cp = "";
       else
 	{
@@ -130,6 +132,7 @@
 	}
 
       charset_aliases = cp;
+      free (file_name);
     }
 
   return cp;