summaryrefslogtreecommitdiff
path: root/libguile/strports.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/strports.c')
-rw-r--r--libguile/strports.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/libguile/strports.c b/libguile/strports.c
index 876a62a86..821a04c4b 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995, 1996, 1998-2003, 2005, 2006, 2009-2014,
- * 2016-2019 Free Software Foundation, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
+/* Copyright 1995,1996,1998-2003,2005-2006,2009-2014,2016-2019
+ Free Software Foundation, Inc.
+
+ This file is part of Guile.
+
+ Guile is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Guile is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with Guile. If not, see
+ <https://www.gnu.org/licenses/>. */
@@ -24,27 +24,29 @@
# include <config.h>
#endif
-#include "libguile/_scm.h"
-
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <intprops.h>
-#include "libguile/bytevectors.h"
-#include "libguile/eval.h"
-#include "libguile/ports.h"
-#include "libguile/read.h"
-#include "libguile/strings.h"
-#include "libguile/modules.h"
-#include "libguile/validate.h"
-#include "libguile/deprecation.h"
-#include "libguile/srfi-4.h"
+#include "bytevectors.h"
+#include "deprecation.h"
+#include "eval.h"
+#include "gsubr.h"
+#include "keywords.h"
+#include "modules.h"
+#include "ports.h"
+#include "procs.h"
+#include "read.h"
+#include "srfi-4.h"
+#include "strings.h"
+#include "symbols.h"
+#include "syscalls.h"
+#include "threads.h"
+#include "variable.h"
+
+#include "strports.h"
-#include "libguile/strports.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
@@ -81,6 +83,8 @@ string_port_read (SCM port, SCM dst, size_t start, size_t count)
return count;
}
+#define MAX(A, B) ((A) >= (B) ? (A) : (B))
+
static size_t
string_port_write (SCM port, SCM src, size_t start, size_t count)
#define FUNC_NAME "string_port_write"
@@ -97,7 +101,7 @@ string_port_write (SCM port, SCM src, size_t start, size_t count)
scm_num_overflow (FUNC_NAME);
/* If (old_size * 2) overflows, it's harmless. */
- new_size = max (old_size * 2, stream->pos + count);
+ new_size = MAX (old_size * 2, stream->pos + count);
new_bv = scm_c_make_bytevector (new_size);
memcpy (SCM_BYTEVECTOR_CONTENTS (new_bv),
SCM_BYTEVECTOR_CONTENTS (stream->bytevector),
@@ -407,12 +411,6 @@ scm_init_strports ()
{
scm_string_port_type = scm_make_string_port_type ();
-#include "libguile/strports.x"
+#include "strports.x"
}
-
-/*
- Local Variables:
- c-file-style: "gnu"
- End:
-*/