svn commit: trunk/uClibc/libc/misc/glob

andersen at uclibc.org andersen at uclibc.org
Wed Jul 5 23:02:01 UTC 2006


Author: andersen
Date: 2006-07-05 16:01:52 -0700 (Wed, 05 Jul 2006)
New Revision: 15649

Log:
remove jump relocs, with minor related cleanups


Modified:
   trunk/uClibc/libc/misc/glob/glob.c
   trunk/uClibc/libc/misc/glob/glob64.c


Changeset:
Modified: trunk/uClibc/libc/misc/glob/glob.c
===================================================================
--- trunk/uClibc/libc/misc/glob/glob.c	2006-07-05 22:19:21 UTC (rev 15648)
+++ trunk/uClibc/libc/misc/glob/glob.c	2006-07-05 23:01:52 UTC (rev 15649)
@@ -31,22 +31,51 @@
 #include <fnmatch.h>
 #include <glob.h>
 
+libc_hidden_proto(closedir)
+libc_hidden_proto(fnmatch)
+libc_hidden_proto(free)
+libc_hidden_proto(malloc)
 libc_hidden_proto(memcpy)
-libc_hidden_proto(strcat)
-libc_hidden_proto(strcmp)
+libc_hidden_proto(mempcpy)
+libc_hidden_proto(opendir)
+libc_hidden_proto(qsort)
+libc_hidden_proto(readdir)
+libc_hidden_proto(readdir64)
+libc_hidden_proto(realloc)
+libc_hidden_proto(stat)
+libc_hidden_proto(stat64)
+libc_hidden_proto(strchr)
+libc_hidden_proto(strcoll)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(strdup)
 libc_hidden_proto(strlen)
 libc_hidden_proto(strrchr)
-libc_hidden_proto(strcoll)
-libc_hidden_proto(opendir)
-libc_hidden_proto(closedir)
-libc_hidden_proto(fnmatch)
-libc_hidden_proto(qsort)
 
+
 #ifdef ENABLE_GLOB_TILDE_EXPANSION
 #include <pwd.h>
 libc_hidden_proto(getpwnam_r)
 #endif
 
+#ifdef COMPILE_GLOB64
+#undef stat
+#define stat stat64
+#define struct_stat64          struct stat64
+#define __stat64(fname, buf)   stat64 (fname, buf)
+#define dirent dirent64
+#define __readdir readdir64
+#define __readdir64 readdir64
+#define glob_t glob64_t
+#define glob(pattern, flags, errfunc, pglob) glob64 (pattern, flags, errfunc, pglob)
+#define globfree(pglob) globfree64 (pglob)
+#else
+#define __readdir readdir
+#define __readdir64 readdir64
+#define struct_stat64          struct stat
+#define __stat64(fname, buf)   stat (fname, buf)
+#endif
+
+
 /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
    if the `d_type' member for `struct dirent' is available.
    HAVE_STRUCT_DIRENT_D_TYPE plays the same role in GNULIB.  */
@@ -99,29 +128,16 @@
 extern void (*__glob_closedir_hook) (__ptr_t stream) attribute_hidden;
 extern const char *(*__glob_readdir_hook) (__ptr_t stream) attribute_hidden;
 
-extern int __collated_compare (const void *a, const void *b) attribute_hidden;
-extern int __prefix_array (const char *dirname, char **array, size_t n) attribute_hidden;
+extern int collated_compare (const void *a, const void *b) attribute_hidden;
+extern int prefix_array (const char *dirname, char **array, size_t n) attribute_hidden;
 #if defined ENABLE_GLOB_BRACE_EXPANSION
 extern const char *__next_brace_sub (const char *cp, int flags) attribute_hidden;
 #endif
 
 libc_hidden_proto(glob_pattern_p)
-#ifdef COMPILE_GLOB64
-libc_hidden_proto(glob64)
-libc_hidden_proto(globfree64)
-libc_hidden_proto(readdir64)
-#define __readdir readdir64
-#define __readdir64 readdir64
-#define struct_stat64          struct stat64
-#define __stat64(fname, buf)   stat64 (fname, buf)
-#else
-libc_hidden_proto(glob)
-libc_hidden_proto(globfree)
-#define __readdir readdir
-#define __readdir64 readdir64
-#define struct_stat64          struct stat
-#define __stat64(fname, buf)   stat (fname, buf)
-libc_hidden_proto(readdir)
+libc_hidden_proto(collated_compare)
+libc_hidden_proto(prefix_array)
+#ifndef COMPILE_GLOB64
 /* Return nonzero if PATTERN contains any metacharacters.
    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
 int glob_pattern_p(const char *pattern, int quote)
@@ -157,7 +173,7 @@
 
 
 /* Do a collated comparison of A and B.  */
-int __collated_compare (const void *a, const void *b)
+int collated_compare (const void *a, const void *b)
 {
   const char *const s1 = *(const char *const * const) a;
   const char *const s2 = *(const char *const * const) b;
@@ -178,7 +194,7 @@
    unless DIRNAME is just "/".  Each old element of ARRAY is freed.
    If ADD_SLASH is non-zero, allocate one character more than
    necessary, so that a slash can be appended later.  */
-int __prefix_array (const char *dirname, char **array, size_t n)
+int prefix_array (const char *dirname, char **array, size_t n)
 {
   register size_t i;
   size_t dirlen = strlen (dirname);
@@ -477,6 +493,13 @@
   return GLOB_NOSPACE;
 }
 
+#ifdef COMPILE_GLOB64
+libc_hidden_proto(glob64)
+libc_hidden_proto(globfree64)
+#else
+libc_hidden_proto(glob)
+libc_hidden_proto(globfree)
+#endif
 /* Do glob searching for PATTERN, placing results in PGLOB.
    The bits defined above may be set in FLAGS.
    If a directory cannot be opened or read and ERRFUNC is not nil,
@@ -930,7 +953,7 @@
 	    }
 
 	  /* Stick the directory on the front of each name.  */
-	  if (__prefix_array (dirs.gl_pathv[i],
+	  if (prefix_array (dirs.gl_pathv[i],
 			    &pglob->gl_pathv[old_pathc + pglob->gl_offs],
 			    pglob->gl_pathc - old_pathc))
 	    {
@@ -999,7 +1022,7 @@
       if (dirlen > 0)
 	{
 	  /* Stick the directory on the front of each name.  */
-	  if (__prefix_array (dirname,
+	  if (prefix_array (dirname,
 			    &pglob->gl_pathv[old_pathc + pglob->gl_offs],
 			    pglob->gl_pathc - old_pathc))
 	    {
@@ -1042,7 +1065,7 @@
       /* Sort the vector.  */
       qsort (&pglob->gl_pathv[oldcount],
 	     pglob->gl_pathc + pglob->gl_offs - oldcount,
-	     sizeof (char *), __collated_compare);
+	     sizeof (char *), collated_compare);
     }
 
   return 0;

Modified: trunk/uClibc/libc/misc/glob/glob64.c
===================================================================
--- trunk/uClibc/libc/misc/glob/glob64.c	2006-07-05 22:19:21 UTC (rev 15648)
+++ trunk/uClibc/libc/misc/glob/glob64.c	2006-07-05 23:01:52 UTC (rev 15649)
@@ -10,16 +10,6 @@
 #include <glob.h>
 #include <sys/stat.h>
 
-#define dirent dirent64
-
-#define glob_t glob64_t
-#define glob(pattern, flags, errfunc, pglob) \
-  glob64 (pattern, flags, errfunc, pglob)
-#define globfree(pglob) globfree64 (pglob)
-
-#undef stat
-#define stat stat64
-
 #define COMPILE_GLOB64    1
 
 #include "glob.c"




More information about the uClibc-cvs mailing list