summaryrefslogtreecommitdiff
path: root/intl/loadmsgcat.c
diff options
context:
space:
mode:
authorChangwoo Ryu <cwryu@src.gnome.org>1998-02-08 17:44:13 +0000
committerChangwoo Ryu <cwryu@src.gnome.org>1998-02-08 17:44:13 +0000
commitfd97971a478cc4026bd2b11cd431946547b520e9 (patch)
tree7314366e4bb5943ae2a933913fdb38cb7365edcb /intl/loadmsgcat.c
parentafc41fa966b013332fd7b1844607e4f78f192389 (diff)
downloadshared-mime-info-fd97971a478cc4026bd2b11cd431946547b520e9.tar.gz
Use code in gettext 0.32.
svn path=/trunk/; revision=60
Diffstat (limited to 'intl/loadmsgcat.c')
-rw-r--r--intl/loadmsgcat.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index d98f365b..73e90a91 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -1,19 +1,19 @@
-/* loadmsgcat.c -- load needed message catalogs
- Copyright (C) 1995 Software Foundation, Inc.
+/* Load needed message catalogs
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -41,8 +41,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* @@ end of prolog @@ */
#ifdef _LIBC
-/* Rename the non ANSI C functions. This is required by the standard
- because some ANSI C functions will require linking with this object
+/* Rename the non ISO C functions. This is required by the standard
+ because some ISO C functions will require linking with this object
file and the name space must not be polluted. */
# define fstat __fstat
# define open __open
@@ -55,14 +55,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* We need a sign, whether a new catalog was loaded, which can be associated
with all translations. This is important if the translations are
cached by one of GCC's features. */
-int _nl_msg_cat_cntr;
+int _nl_msg_cat_cntr = 0;
/* Load the message catalogs specified by FILENAME. If it is no valid
message catalog do nothing. */
void
-_nl_load_domain (domain)
- struct loaded_domain *domain;
+_nl_load_domain (domain_file)
+ struct loaded_l10nfile *domain_file;
{
int fd;
struct stat st;
@@ -71,19 +71,20 @@ _nl_load_domain (domain)
|| defined _LIBC
int use_mmap = 0;
#endif
+ struct loaded_domain *domain;
- domain->decided = 1;
- domain->data = NULL;
+ domain_file->decided = 1;
+ domain_file->data = NULL;
/* If the record does not represent a valid locale the FILENAME
might be NULL. This can happen when according to the given
specification the locale file name is different for XPG and CEN
syntax. */
- if (domain->filename == NULL)
+ if (domain_file->filename == NULL)
return;
/* Try to open the addressed file. */
- fd = open (domain->filename, O_RDONLY);
+ fd = open (domain_file->filename, O_RDONLY);
if (fd == -1)
return;
@@ -156,6 +157,12 @@ _nl_load_domain (domain)
return;
}
+ domain_file->data
+ = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
+ if (domain_file->data == NULL)
+ return;
+
+ domain = (struct loaded_domain *) domain_file->data;
domain->data = (char *) data;
domain->must_swap = data->magic != _MAGIC;
@@ -181,11 +188,12 @@ _nl_load_domain (domain)
else
#endif
free (data);
- domain->data = NULL;
+ free (domain);
+ domain_file->data = NULL;
return;
}
/* Show that one domain is changed. This might make some cached
- translation invalid. */
+ translations invalid. */
++_nl_msg_cat_cntr;
}