summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-28 11:53:57 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-28 11:53:57 +0100
commit87fc4596e54d69559ce27868dd1a604ea322a6b1 (patch)
tree60b9f821b54c492ebd746ae5d99a6363f99c5e1e
parent35164d84e093ddf9e463fb72cc355c68a4ee92c9 (diff)
downloadguile-87fc4596e54d69559ce27868dd1a604ea322a6b1.tar.gz
Remove private-gc.h
* libguile/simpos.c (scm_getenv_int): Move here, from gc.c. * libguile/private-gc.h: Remove, unused. * libguile/simpos.h: Move scm_getenv_int declaration here. * libguile/vm.c: * libguile/gc.c: Adapt scm_getenv_int users. * libguile/gc-malloc.c: * libguile/load.c: * libguile/script.c: Remove private-gc includes from non-users of scm_getenv_int. * libguile/Makefile.am: Adapt.
-rw-r--r--libguile/Makefile.am2
-rw-r--r--libguile/gc-malloc.c2
-rw-r--r--libguile/gc.c21
-rw-r--r--libguile/load.c1
-rw-r--r--libguile/private-gc.h30
-rw-r--r--libguile/script.c3
-rw-r--r--libguile/simpos.c17
-rw-r--r--libguile/simpos.h3
-rw-r--r--libguile/vm.c3
9 files changed, 22 insertions, 60 deletions
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 24d36f242..3f66d9d8d 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -469,7 +469,7 @@ noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
srfi-14.i.c \
quicksort.i.c \
win32-uname.h \
- private-gc.h private-options.h ports-internal.h
+ private-options.h ports-internal.h
# vm instructions
noinst_HEADERS += vm-engine.c
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 994f222d0..63e670564 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -52,8 +52,6 @@ extern unsigned long * __libc_ia64_register_backing_store_base;
#include "libguile/deprecation.h"
#include "libguile/gc.h"
-#include "libguile/private-gc.h"
-
#ifdef GUILE_DEBUG_MALLOC
#include "libguile/debug-malloc.h"
#endif
diff --git a/libguile/gc.c b/libguile/gc.c
index 3019a7e92..aebc13f87 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -46,12 +46,12 @@ extern unsigned long * __libc_ia64_register_backing_store_base;
#include "libguile/async.h"
#include "libguile/ports.h"
#include "libguile/root.h"
+#include "libguile/simpos.h"
#include "libguile/strings.h"
#include "libguile/vectors.h"
#include "libguile/hashtab.h"
#include "libguile/tags.h"
-#include "libguile/private-gc.h"
#include "libguile/validate.h"
#include "libguile/deprecation.h"
#include "libguile/gc.h"
@@ -568,25 +568,6 @@ scm_gc_unregister_roots (SCM *b, unsigned long n)
-/*
- MOVE THIS FUNCTION. IT DOES NOT HAVE ANYTHING TODO WITH GC.
- */
-
-/* Get an integer from an environment variable. */
-int
-scm_getenv_int (const char *var, int def)
-{
- char *end = 0;
- char *val = getenv (var);
- long res = def;
- if (!val)
- return def;
- res = strtol (val, &end, 10);
- if (end == val)
- return def;
- return res;
-}
-
void
scm_storage_prehistory ()
{
diff --git a/libguile/load.c b/libguile/load.c
index ebf79a9eb..16e3fb2a6 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include "libguile/_scm.h"
-#include "libguile/private-gc.h" /* scm_getenv_int */
#include "libguile/libpath.h"
#include "libguile/fports.h"
#include "libguile/read.h"
diff --git a/libguile/private-gc.h b/libguile/private-gc.h
deleted file mode 100644
index 18e334162..000000000
--- a/libguile/private-gc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * private-gc.h - private declarations for garbage collection.
- *
- * Copyright (C) 2002, 03, 04, 05, 06, 07, 08, 09, 11, 13 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
- */
-
-#ifndef SCM_PRIVATE_GC
-#define SCM_PRIVATE_GC
-
-#include "_scm.h"
-
-
-SCM_INTERNAL int scm_getenv_int (const char *var, int def);
-
-#endif
diff --git a/libguile/script.c b/libguile/script.c
index 83daf8ac1..052ab8d42 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-1998, 2000-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1994-1998, 2000-2011, 2013 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
@@ -33,7 +33,6 @@
#include "libguile/eval.h"
#include "libguile/feature.h"
#include "libguile/load.h"
-#include "libguile/private-gc.h" /* scm_getenv_int */
#include "libguile/read.h"
#include "libguile/script.h"
#include "libguile/strings.h"
diff --git a/libguile/simpos.c b/libguile/simpos.c
index 8859d4f15..7865da647 100644
--- a/libguile/simpos.c
+++ b/libguile/simpos.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2004, 2009,
- * 2010, 2012 Free Software Foundation, Inc.
+ * 2010, 2012, 2013 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
@@ -190,6 +190,21 @@ SCM_DEFINE (scm_getenv, "getenv", 1, 0, 0,
}
#undef FUNC_NAME
+/* Get an integer from an environment variable. */
+int
+scm_getenv_int (const char *var, int def)
+{
+ char *end = 0;
+ char *val = getenv (var);
+ long res = def;
+ if (!val)
+ return def;
+ res = strtol (val, &end, 10);
+ if (end == val)
+ return def;
+ return res;
+}
+
/* simple exit, without unwinding the scheme stack or flushing ports. */
SCM_DEFINE (scm_primitive_exit, "primitive-exit", 0, 1, 0,
(SCM status),
diff --git a/libguile/simpos.h b/libguile/simpos.h
index b391a28d8..1e2076870 100644
--- a/libguile/simpos.h
+++ b/libguile/simpos.h
@@ -3,7 +3,7 @@
#ifndef SCM_SIMPOS_H
#define SCM_SIMPOS_H
-/* Copyright (C) 1995,1996,1997,1998,2000, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000, 2006, 2008, 2013 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
@@ -32,6 +32,7 @@ SCM_API SCM scm_system_star (SCM cmds);
SCM_API SCM scm_getenv (SCM nam);
SCM_API SCM scm_primitive_exit (SCM status);
SCM_API SCM scm_primitive__exit (SCM status);
+SCM_INTERNAL int scm_getenv_int (const char *var, int def);
SCM_INTERNAL void scm_init_simpos (void);
#endif /* SCM_SIMPOS_H */
diff --git a/libguile/vm.c b/libguile/vm.c
index f9441ad20..5a6958900 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -42,11 +42,10 @@
#include "instructions.h"
#include "loader.h"
#include "programs.h"
+#include "simpos.h"
#include "vm.h"
#include "vm-builtins.h"
-#include "private-gc.h" /* scm_getenv_int */
-
static int vm_default_engine = SCM_VM_REGULAR_ENGINE;
/* Unfortunately we can't snarf these: snarfed things are only loaded up from