aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-05-22 10:23:35 +0000
committerUlrich Drepper <drepper@redhat.com>1998-05-22 10:23:35 +0000
commitd553bbf23643fd07d76a19f000b78efc13e1ff7e (patch)
treed3ac3f2dd686403534b3fea66c79553b000c7c18
parent3dcf8ea677b811ec326b9692163f9e802663f9cc (diff)
downloadglibc-d553bbf23643fd07d76a19f000b78efc13e1ff7e.tar
glibc-d553bbf23643fd07d76a19f000b78efc13e1ff7e.tar.gz
glibc-d553bbf23643fd07d76a19f000b78efc13e1ff7e.tar.bz2
glibc-d553bbf23643fd07d76a19f000b78efc13e1ff7e.zip
Update.
1998-05-22 Ulrich Drepper <drepper@cygnus.com> * catgets/open_catalog.c (__open_catalog): Use byteswap.h functions. Optimize filename creation a bit. 1998-05-22 09:29 Ulrich Drepper <drepper@cygnus.com> * stdlib/random_r.c: Help gcc to optimize the code. Patch by Joe Keane <jgk@jgk.org>.
-rw-r--r--ChangeLog10
-rw-r--r--catgets/open_catalog.c25
2 files changed, 25 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e7e9d3ee4..99df4d8cbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+1998-05-22 Ulrich Drepper <drepper@cygnus.com>
+
+ * catgets/open_catalog.c (__open_catalog): Use byteswap.h
+ functions. Optimize filename creation a bit.
+
+1998-05-22 09:29 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdlib/random_r.c: Help gcc to optimize the code.
+ Patch by Joe Keane <jgk@jgk.org>.
+
1998-05-21 Ulrich Drepper <drepper@cygnus.com>
* iconv/iconv_prog.c (print_known_names): Use strverscmp in all
diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
index 2197eb8363..9d54124cd0 100644
--- a/catgets/open_catalog.c
+++ b/catgets/open_catalog.c
@@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <byteswap.h>
#include <endian.h>
#include <fcntl.h>
#include <string.h>
@@ -28,8 +29,7 @@
#include "catgetsinfo.h"
-#define SWAPU32(w) \
- (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
+#define SWAPU32(w) bswap_32 (w)
void
@@ -68,6 +68,7 @@ __open_catalog (__nl_catd catalog)
char *buf;
size_t bufact;
size_t bufmax;
+ size_t len;
buf = NULL;
bufmax = 0;
@@ -86,13 +87,17 @@ __open_catalog (__nl_catd catalog)
{
case 'N':
/* Use the catalog name. */
- ENOUGH (strlen (catalog->cat_name));
- bufact = __stpcpy (&buf[bufact], catalog->cat_name) - buf;
+ len = strlen (catalog->cat_name);
+ ENOUGH (len);
+ memcpy (&buf[bufact], catalog->cat_name, len);
+ bufact += len;
break;
case 'L':
/* Use the current locale category value. */
- ENOUGH (strlen (catalog->env_var));
- bufact = __stpcpy (&buf[bufact], catalog->env_var) - buf;
+ len = strlen (catalog->env_var);
+ ENOUGH (len);
+ memcpy (&buf[bufact], catalog->env_var, len);
+ bufact += len;
break;
case 'l':
/* Use language element of locale category value. */
@@ -178,15 +183,15 @@ __open_catalog (__nl_catd catalog)
#ifndef MAP_COPY
/* Linux seems to lack read-only copy-on-write. */
-#define MAP_COPY MAP_PRIVATE
+# define MAP_COPY MAP_PRIVATE
#endif
#ifndef MAP_FILE
/* Some systems do not have this flag; it is superfluous. */
-#define MAP_FILE 0
+# define MAP_FILE 0
#endif
#ifndef MAP_INHERIT
/* Some systems might lack this; they lose. */
-#define MAP_INHERIT 0
+# define MAP_INHERIT 0
#endif
catalog->file_size = st.st_size;
catalog->file_ptr =
@@ -237,7 +242,7 @@ __open_catalog (__nl_catd catalog)
swapping = 1;
else
{
- /* Illegal file. Free the resources and mark catalog as not
+ /* Invalid file. Free the resources and mark catalog as not
usable. */
if (catalog->status == mmapped)
__munmap ((void *) catalog->file_ptr, catalog->file_size);