diff options
-rw-r--r-- | libguile/filesys.c | 25 | ||||
-rw-r--r-- | libguile/private-gc.h | 7 |
2 files changed, 14 insertions, 18 deletions
diff --git a/libguile/filesys.c b/libguile/filesys.c index 1893c02cd..8597f9096 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -44,7 +44,6 @@ #include "libguile/smob.h" #include "libguile/feature.h" #include "libguile/fports.h" -#include "libguile/private-gc.h" /* for SCM_MAX */ #include "libguile/strings.h" #include "libguile/vectors.h" #include "libguile/dynwind.h" @@ -141,6 +140,10 @@ eno = errno; scm_dynwind_end (); errno = eno; \ } while (0) + +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) + #ifdef HAVE_POSIX @@ -1192,7 +1195,7 @@ SCM_DEFINE (scm_sendfile, "sendfile", 3, 1, 0, { size_t asked, obtained, written; - asked = SCM_MIN (sizeof buf, left); + asked = MIN (sizeof buf, left); obtained = full_read (in_fd, buf, asked); if (obtained < asked) { @@ -1743,11 +1746,11 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0, SCM_MISC_ERROR ("Directory ~S is not open.", scm_list_1 (port)); #if HAVE_READDIR_R - /* As noted in the glibc manual, on various systems (such as Solaris) the - d_name[] field is only 1 char and you're expected to size the dirent - buffer for readdir_r based on NAME_MAX. The SCM_MAX expressions below - effectively give either sizeof(d_name) or NAME_MAX+1, whichever is - bigger. + /* As noted in the glibc manual, on various systems (such as Solaris) + the d_name[] field is only 1 char and you're expected to size the + dirent buffer for readdir_r based on NAME_MAX. The MAX expressions + below effectively give either sizeof(d_name) or NAME_MAX+1, + whichever is bigger. On solaris 10 there's no NAME_MAX constant, it's necessary to use pathconf(). We prefer NAME_MAX though, since it should be a constant @@ -1761,15 +1764,15 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0, struct dirent_or_dirent64 de; /* just for sizeof */ DIR *ds = (DIR *) SCM_SMOB_DATA_1 (port); #ifdef NAME_MAX - char buf [SCM_MAX (sizeof (de), - sizeof (de) - sizeof (de.d_name) + NAME_MAX + 1)]; + char buf [MAX (sizeof (de), + sizeof (de) - sizeof (de.d_name) + NAME_MAX + 1)]; #else char *buf; long name_max = fpathconf (dirfd (ds), _PC_NAME_MAX); if (name_max == -1) SCM_SYSERROR; - buf = alloca (SCM_MAX (sizeof (de), - sizeof (de) - sizeof (de.d_name) + name_max + 1)); + buf = alloca (MAX (sizeof (de), + sizeof (de) - sizeof (de.d_name) + name_max + 1)); #endif errno = 0; diff --git a/libguile/private-gc.h b/libguile/private-gc.h index 0a48d1ab6..4e733851f 100644 --- a/libguile/private-gc.h +++ b/libguile/private-gc.h @@ -25,15 +25,8 @@ #include "_scm.h" -#define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0) - - SCM_INTERNAL int scm_getenv_int (const char *var, int def); - -#define SCM_MAX(A, B) ((A) > (B) ? (A) : (B)) -#define SCM_MIN(A, B) ((A) < (B) ? (A) : (B)) - SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */ #endif |