From 449be2a5e5670b8ae1e02aaaddbd4425a8785205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 6 Oct 2014 15:22:44 +0200 Subject: [PATCH 1/5] build: Adjust autogen.sh to 'libtoolize' name on Darwin. Reported by Daniel Llorens. * autogen.sh: Use 'glibtoolize' on Darwin. --- autogen.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index af1ade60d..2e39fb5d8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,7 +15,15 @@ autoconf --version echo "" automake --version echo "" -libtoolize --version + +# Typical MacOS X installations rename 'libtoolize' to 'glibtoolize', so +# adjust to that. +if test "`uname -s`" = "Darwin"; then + glibtoolize --version +else + libtoolize --version +fi + echo "" ${M4:-m4} --version echo "" From 6b47249a28c7725714ee0e356d3d4b01dfc96aa2 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 6 Oct 2014 23:53:08 -0400 Subject: [PATCH 2/5] Thank Per Bothner. * THANKS: Add Per Bothner to the "libraries" section (for SRFI-64). --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 1cc749aab..fa9963344 100644 --- a/THANKS +++ b/THANKS @@ -43,6 +43,7 @@ Authors of free software libraries that have been included into Guile since the last release: Jim Bender + Per Bothner Rob Browning Oleg Kiselyov Alex Shinn From b9ace68613395fda26f3f3d7dc2ac9bc52cd7f2a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Fri, 10 Oct 2014 22:36:54 -0400 Subject: [PATCH 3/5] scm_boot_guile: Gracefully handle the case where argc == 0. Fixes . Reported by Nala Ginrut . * libguile/init.c (scm_boot_guile): Do not canonicalize argv[0] unless argc > 0. * THANKS: Add Nala Ginrut to the fixes section. --- THANKS | 1 + libguile/init.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/THANKS b/THANKS index fa9963344..1aeb4a429 100644 --- a/THANKS +++ b/THANKS @@ -86,6 +86,7 @@ For fixes or providing information which led to a fix: Andrew Gaylard Nils Gey Eric Gillespie, Jr + Nala Ginrut Didier Godefroy Panicz Maciej Godek John Goerzen diff --git a/libguile/init.c b/libguile/init.c index f55841337..1348c2d79 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -1,6 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - * 2004, 2006, 2009, 2010, 2011, 2012, 2013, - * 2014 Free Software Foundation, Inc. +/* Copyright (C) 1995-2004, 2006, 2009-2014 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 @@ -314,7 +312,9 @@ scm_boot_guile (int argc, char ** argv, void (*main_func) (), void *closure) /* On Windows, convert backslashes in argv[0] to forward slashes. */ - scm_i_mirror_backslashes (argv[0]); + if (argc > 0) + scm_i_mirror_backslashes (argv[0]); + c.main_func = main_func; c.closure = closure; c.argc = argc; From 30c5982a9548a0ca0ea46111beb490f06d74a40a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 14 Oct 2014 20:36:11 -0400 Subject: [PATCH 4/5] i18n: Add HAVE_USELOCALE as a requirement for USE_GNU_LOCALE_API. * configure.ac: Check for uselocale. * libguile/i18n.c: Add HAVE_USELOCALE to the list of requirements before defining USE_GNU_LOCALE_API. --- configure.ac | 5 ++--- libguile/i18n.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a323f7093..4f40736ab 100644 --- a/configure.ac +++ b/configure.ac @@ -751,9 +751,8 @@ AC_CHECK_HEADERS([assert.h crt_externs.h]) # truncate - not in mingw # isblank - available as a GNU extension or in C99 # _NSGetEnviron - Darwin specific -# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin +# strcoll_l, newlocale, uselocale, utimensat - POSIX.1-2008 # fork - unavailable on Windows -# utimensat - posix.1-2008 # sched_getaffinity, sched_setaffinity - GNU extensions (glibc) # sendfile - non-POSIX, found in glibc # @@ -766,7 +765,7 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \ strdup system usleep atexit on_exit chown link fcntl ttyname getpwent \ getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \ index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron \ - strcoll strcoll_l newlocale utimensat sched_getaffinity \ + strcoll strcoll_l newlocale uselocale utimensat sched_getaffinity \ sched_setaffinity sendfile]) # Reasons for testing: diff --git a/libguile/i18n.c b/libguile/i18n.c index c6b9b845e..f0e344329 100644 --- a/libguile/i18n.c +++ b/libguile/i18n.c @@ -40,7 +40,7 @@ #include #include -#if (defined HAVE_NEWLOCALE) && (defined HAVE_STRCOLL_L) +#if defined HAVE_NEWLOCALE && defined HAVE_STRCOLL_L && defined HAVE_USELOCALE /* The GNU thread-aware locale API is documented in ``Thread-Aware Locale Model, a Proposal'', by Ulrich Drepper: From a7bbba05838cabe2294f498e7008e1c51db6d664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 31 Oct 2014 22:53:04 +0100 Subject: [PATCH 5/5] Use on-stack or GC-managed memory in 'search-path'. * libguile/load.c (stringbuf_free): Remove. (stringbuf_grow): Use 'scm_gc_malloc_pointerless' instead of 'scm_realloc'. (search_path): Use stack-allocated INITIAL_BUFFER instead of 'scm_malloc'. Remove use of 'stringbuf_free'. --- libguile/load.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libguile/load.c b/libguile/load.c index 74ccd088f..79d711cc1 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -403,24 +403,24 @@ SCM scm_listofnullstr; /* Utility functions for assembling C strings in a buffer. */ -struct stringbuf { +struct stringbuf +{ char *buf, *ptr; size_t buf_len; }; -static void -stringbuf_free (void *data) -{ - struct stringbuf *buf = (struct stringbuf *)data; - free (buf->buf); -} - static void stringbuf_grow (struct stringbuf *buf) { - size_t ptroff = buf->ptr - buf->buf; - buf->buf_len *= 2; - buf->buf = scm_realloc (buf->buf, buf->buf_len); + size_t ptroff, prev_len; + void *prev_buf = buf->buf; + + prev_len = buf->buf_len; + ptroff = buf->ptr - buf->buf; + + buf->buf_len *= 2; + buf->buf = scm_gc_malloc_pointerless (buf->buf_len, "search-path"); + memcpy (buf->buf, prev_buf, prev_len); buf->ptr = buf->buf + ptroff; } @@ -558,6 +558,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts, char *filename_chars; size_t filename_len; SCM result = SCM_BOOL_F; + char initial_buffer[256]; if (scm_ilength (path) < 0) scm_misc_error ("%search-path", "path is not a proper list: ~a", @@ -619,9 +620,8 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts, if (scm_is_null (extensions)) extensions = scm_listofnullstr; - buf.buf_len = 512; - buf.buf = scm_malloc (buf.buf_len); - scm_dynwind_unwind_handler (stringbuf_free, &buf, SCM_F_WIND_EXPLICITLY); + buf.buf_len = sizeof initial_buffer; + buf.buf = initial_buffer; /* Try every path element. */