diff options
author | Eric Andersen <andersen@codepoet.org> | 2006-07-13 16:32:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2006-07-13 16:32:02 +0000 |
commit | a2a3c80101de57f0276c63d97bcff4f7f40d4ad3 (patch) | |
tree | e4ea1477b8032e3924d6036fe6d16c346fc81c7b /libc | |
parent | 550aa275f96effab778e6c77da7b9b59f7fc9d0e (diff) |
patch from psm:
- malloc/realloc/free are not prepared to be hidable in trunk, you can't
use libc_hidden_proto(x) for them
- using libc_hidden_proto(x64) LFS unguarded will fail because the header
does not provide the prototype
- if you are using libc_hidden_proto(collated_compare|prefix_array), you
also need libc_hidden_def|_weak(x) after the function itself, the result
being to provide a hidden __GI_collated_compare and a visible
collated_compare, for this case I do not consider this necessary,
especially that collated_compare is hidden already (I have chosen to
prefix them with __ to know that they are intended to be internal only,
against the practice in glibc, you could go without prefix as well)
Diffstat (limited to 'libc')
-rw-r--r-- | libc/misc/glob/glob.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 49d48e2da..f510a7b52 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -33,17 +33,11 @@ libc_hidden_proto(closedir) libc_hidden_proto(fnmatch) -libc_hidden_proto(free) -libc_hidden_proto(malloc) libc_hidden_proto(memcpy) 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) @@ -68,11 +62,19 @@ libc_hidden_proto(getpwnam_r) #define glob_t glob64_t #define glob(pattern, flags, errfunc, pglob) glob64 (pattern, flags, errfunc, pglob) #define globfree(pglob) globfree64 (pglob) +libc_hidden_proto(stat64) +libc_hidden_proto(readdir64) #else #define __readdir readdir +#ifdef __UCLIBC_HAS_LFS__ #define __readdir64 readdir64 +libc_hidden_proto(readdir64) +#else +#define __readdir64 readdir +#endif #define struct_stat64 struct stat #define __stat64(fname, buf) stat (fname, buf) +libc_hidden_proto(stat) #endif @@ -124,19 +126,13 @@ libc_hidden_proto(getpwnam_r) CONVERT_D_INO (d64, d32) \ CONVERT_D_TYPE (d64, d32) -extern __ptr_t (*__glob_opendir_hook) (const char *directory) attribute_hidden; -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) -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. */ @@ -173,7 +169,7 @@ libc_hidden_def(glob_pattern_p) /* 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; @@ -194,7 +190,7 @@ int collated_compare (const void *a, const void *b) 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); @@ -953,7 +949,7 @@ glob (pattern, flags, errfunc, pglob) } /* 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)) { @@ -1022,7 +1018,7 @@ glob (pattern, flags, errfunc, pglob) 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)) { @@ -1065,7 +1061,7 @@ glob (pattern, flags, errfunc, pglob) /* 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; |