summaryrefslogtreecommitdiff
path: root/libguile/filesys.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-28 11:43:51 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-28 11:43:51 +0100
commit5a706f034224869dfe4002c3f486c47e8a05c76d (patch)
treeb332803bb37018ed03e59b1ee46498a0257c8054 /libguile/filesys.c
parent8d78304e4d2123ee1c6047dd6f4b5a2a0f41e19f (diff)
downloadguile-5a706f034224869dfe4002c3f486c47e8a05c76d.tar.gz
More private-gc excisions
* libguile/private-gc.h (SCM_DOUBLECELL_ALIGNED_P): Remove; unused. * libguile/filesys.c (MAX, MIN): Move definitions here, from private-gc.h. (scm_sendfile, scm_readdir): Adapt uses of SCM_MAX and SCM_MIN to use MAX or MIN.
Diffstat (limited to 'libguile/filesys.c')
-rw-r--r--libguile/filesys.c25
1 files changed, 14 insertions, 11 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;