mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix the possible conflicts with other libs (like libc-client)
This commit is contained in:
parent
8e3f23e3c0
commit
ec11fe04e9
@ -30,11 +30,10 @@
|
||||
#include "zend_highlight.h"
|
||||
#include "SAPI.h"
|
||||
#include "php_main.h"
|
||||
#include "php_scandir.h"
|
||||
|
||||
#if !HAVE_SCANDIR || !HAVE_ALPHASORT
|
||||
#include "php_scandir.h"
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
@ -432,7 +431,7 @@ int php_init_config()
|
||||
struct dirent **namelist;
|
||||
int ndir, i;
|
||||
|
||||
if ((ndir = scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, alphasort)) > 0) {
|
||||
if ((ndir = php_scandir(PHP_CONFIG_FILE_SCAN_DIR, &namelist, 0, php_alphasort)) > 0) {
|
||||
for (i = 0; i < ndir; i++) {
|
||||
/* check for a .ini extension */
|
||||
if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
|
||||
|
@ -17,6 +17,8 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include "config.w32.h"
|
||||
#else
|
||||
@ -26,7 +28,10 @@
|
||||
#include "php_scandir.h"
|
||||
|
||||
#ifndef HAVE_SCANDIR
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
@ -38,19 +43,23 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <search.h>
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_SCANDIR */
|
||||
|
||||
#ifndef HAVE_ALPHASORT
|
||||
#include <string.h>
|
||||
|
||||
int alphasort(const struct dirent **a, const struct dirent **b)
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
int php_alphasort(const struct dirent **a, const struct dirent **b)
|
||||
{
|
||||
return strcoll((*a)->d_name,(*b)->d_name);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_ALPHASORT */
|
||||
|
||||
#ifndef HAVE_SCANDIR
|
||||
int scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b))
|
||||
int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b))
|
||||
{
|
||||
DIR *dirp = NULL;
|
||||
struct dirent **vector = NULL;
|
||||
@ -117,3 +126,12 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
@ -1,3 +1,27 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Shane Caraveo <shane@caraveo.com> |
|
||||
| Ilia Alshanetsky <ilia@prohost.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_SCANDIR_H
|
||||
#define PHP_SCANDIR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
@ -7,14 +31,19 @@
|
||||
#include "php_config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SCANDIR
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#define php_scandir scandir
|
||||
#else
|
||||
int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b));
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ALPHASORT
|
||||
int alphasort(const struct dirent **a, const struct dirent **b);
|
||||
#ifdef HAVE_ALPHASORT
|
||||
#define php_alphasort alphasort
|
||||
#else
|
||||
int php_alphasort(const struct dirent **a, const struct dirent **b);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SCANDIR
|
||||
int scandir(const char *dirname, struct dirent **namelist[], int (*selector) (const struct dirent *entry), int (*compare) (const struct dirent **a, const struct dirent **b));
|
||||
#endif
|
||||
#endif /* PHP_SCANDIR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user