guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-3-70-g31a


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-3-70-g31ab99d
Date: Wed, 14 Oct 2009 23:06:30 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=31ab99de563027fe2bceb60bbd712407fcaf868e

The branch, master has been updated
       via  31ab99de563027fe2bceb60bbd712407fcaf868e (commit)
       via  682d78d05e567a46b1c443c5f852c575ab529f5a (commit)
       via  c72b0ca3b076837a8a2b444fa7ab6d8c16b0b0c4 (commit)
      from  5ebc8b81411ed261d66b9137e737cb9efe0e5aa8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 31ab99de563027fe2bceb60bbd712407fcaf868e
Author: Ludovic Courtès <address@hidden>
Date:   Thu Oct 15 01:05:32 2009 +0200

    Restore signature of `scm_primitive_load_path ()' as found in 1.8.
    
    The incompatibility was introduced by
    0fb81f95b0222c5ba49efd3e36cf797df54c0863 ("add exception_on_error
    optional arg to primitive-load-path").
    
    * libguile/load.c (scm_primitive_load_path): Change to take 1 rest
      argument.  Interpret the argument as either a file name (C-level
      backward compatibility with 1.8) or an actual argument list.
      (scm_c_primitive_load_path): Update caller.
    
    * libguile/load.h (scm_primitive_load_path): Update accordingly.
    
    * doc/ref/api-evaluation.texi (Loading): Update documentation of
      `primitive-load-path' and `scm_primitive_load_path ()'.

commit 682d78d05e567a46b1c443c5f852c575ab529f5a
Author: Ludovic Courtès <address@hidden>
Date:   Thu Oct 15 00:56:56 2009 +0200

    Use GC-managed memory for port->encoding.
    
    * libguile/ports.c (scm_new_port_table_entry): Use `scm_gc_strdup ()'
      instead of `strdup ()' for `entry->encoding'.
      (scm_i_set_port_encoding_x): Likewise.  Remove free(3) call.
      (scm_i_remove_port): Don't explicitly free memory.
      (scm_unget_byte): Remove outdated and misleading comment.

commit c72b0ca3b076837a8a2b444fa7ab6d8c16b0b0c4
Author: Ludovic Courtès <address@hidden>
Date:   Wed Oct 14 23:20:54 2009 +0200

    Fix signed/unsigned mismatch in `scm_array_handle_{ref,set} ()'.
    
    * libguile/inline.h (scm_array_handle_ref, scm_array_handle_set): Cast
      `h->base' so that it matches the signedness of `p'.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-evaluation.texi |   11 +++++++++--
 libguile/inline.h           |    4 ++--
 libguile/load.c             |   31 +++++++++++++++++++++++++++----
 libguile/load.h             |    4 ++--
 libguile/ports.c            |   21 +++++++--------------
 5 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index b245ab8..c484952 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2009
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -538,13 +538,20 @@ documentation for @code{%load-hook} later in this section.
 @code{SCM}.
 @end deftypefn
 
address@hidden {Scheme Procedure} primitive-load-path filename
address@hidden {Scheme Procedure} primitive-load-path filename 
[exception-on-not-found]
 @deffnx {C Function} scm_primitive_load_path (filename)
 Search @code{%load-path} for the file named @var{filename} and
 load it into the top-level environment.  If @var{filename} is a
 relative pathname and is not found in the list of search paths,
 an error is signalled. Preferentially loads a compiled version of the
 file, if it is available and up-to-date.
+
+By default or if @var{exception-on-not-found} is true, an exception is
+raised if @var{filename} is not found.  If @var{exception-on-not-found}
+is @code{#f} and @var{filename} is not found, no exception is raised and
address@hidden is returned.  For compatibility with Guile 1.8 and earlier,
+the C function takes only one argument, which can be either a string
+(the file name) or an argument list.
 @end deffn
 
 @deffn {Scheme Procedure} %search-load-path filename
diff --git a/libguile/inline.h b/libguile/inline.h
index 93be809..a8f24d4 100644
--- a/libguile/inline.h
+++ b/libguile/inline.h
@@ -243,7 +243,7 @@ SCM_C_EXTERN_INLINE
 SCM
 scm_array_handle_ref (scm_t_array_handle *h, ssize_t p)
 {
-  if (SCM_UNLIKELY (p < 0 && -p > h->base))
+  if (SCM_UNLIKELY (p < 0 && -p > (ssize_t) h->base))
     /* catch overflow */
     scm_out_of_range (NULL, scm_from_ssize_t (p));
   /* perhaps should catch overflow here too */
@@ -256,7 +256,7 @@ SCM_C_EXTERN_INLINE
 void
 scm_array_handle_set (scm_t_array_handle *h, ssize_t p, SCM v)
 {
-  if (SCM_UNLIKELY (p < 0 && -p > h->base))
+  if (SCM_UNLIKELY (p < 0 && -p > (ssize_t) h->base))
     /* catch overflow */
     scm_out_of_range (NULL, scm_from_ssize_t (p));
   /* perhaps should catch overflow here too */
diff --git a/libguile/load.c b/libguile/load.c
index 10cbdb2..50af256 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -685,8 +685,8 @@ scm_try_autocompile (SCM source)
                       NULL, NULL);
 }
 
-SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 1, 1, 0, 
-           (SCM filename, SCM exception_on_not_found),
+SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
+           (SCM args),
            "Search @var{%load-path} for the file named @var{filename} and\n"
            "load it into the top-level environment.  If @var{filename} is a\n"
            "relative pathname and is not found in the list of search paths,\n"
@@ -695,9 +695,33 @@ SCM_DEFINE (scm_primitive_load_path, 
"primitive-load-path", 1, 1, 0,
             "@code{#f} is returned instead.")
 #define FUNC_NAME s_scm_primitive_load_path
 {
+  SCM filename, exception_on_not_found;
   SCM full_filename, compiled_filename;
   int compiled_is_fallback = 0;
 
+  if (scm_is_string (args))
+    {
+      /* C code written for 1.8 and earlier expects this function to take a
+        single argument (the file name).  */
+      filename = args;
+      exception_on_not_found = SCM_UNDEFINED;
+    }
+  else
+    {
+      /* Starting from 1.9, this function takes 1 required and 1 optional
+        argument.  */
+      long len;
+
+      SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, args, len);
+      if (len < 1 || len > 2)
+       scm_error_num_args_subr (FUNC_NAME);
+
+      filename = SCM_CAR (args);
+      SCM_VALIDATE_STRING (SCM_ARG1, filename);
+
+      exception_on_not_found = len > 1 ? SCM_CADR (args) : SCM_UNDEFINED;
+    }
+
   if (SCM_UNBNDP (exception_on_not_found))
     exception_on_not_found = SCM_BOOL_T;
 
@@ -775,8 +799,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 
1, 1, 0,
 SCM
 scm_c_primitive_load_path (const char *filename)
 {
-  return scm_primitive_load_path (scm_from_locale_string (filename),
-                                  SCM_BOOL_T);
+  return scm_primitive_load_path (scm_from_locale_string (filename));
 }
 
 
diff --git a/libguile/load.h b/libguile/load.h
index 1a1a865..cf825fc 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -3,7 +3,7 @@
 #ifndef SCM_LOAD_H
 #define SCM_LOAD_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009 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
@@ -34,7 +34,7 @@ SCM_API SCM scm_sys_library_dir (void);
 SCM_API SCM scm_sys_site_dir (void);
 SCM_API SCM scm_search_path (SCM path, SCM filename, SCM exts, SCM 
require_exts);
 SCM_API SCM scm_sys_search_load_path (SCM filename);
-SCM_API SCM scm_primitive_load_path (SCM filename, SCM exception_on_not_found);
+SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found);
 SCM_API SCM scm_c_primitive_load_path (const char *filename);
 SCM_INTERNAL SCM scm_sys_warn_autocompilation_enabled (void);
 SCM_INTERNAL void scm_init_load_path (void);
diff --git a/libguile/ports.c b/libguile/ports.c
index 53f64e3..c3415c7 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -587,7 +587,7 @@ scm_new_port_table_entry (scm_t_bits tag)
   if ((enc = scm_i_get_port_encoding (SCM_BOOL_F)) == NULL)
     entry->encoding = NULL;
   else
-    entry->encoding = strdup (enc);
+    entry->encoding = scm_gc_strdup (enc, "port");
   entry->ilseq_handler = scm_i_get_conversion_strategy (SCM_BOOL_F);
 
   SCM_SET_CELL_TYPE (z, tag);
@@ -627,14 +627,11 @@ scm_i_remove_port (SCM port)
 #define FUNC_NAME "scm_remove_port"
 {
   scm_t_port *p = SCM_PTAB_ENTRY (port);
-  if (p->putback_buf)
-    scm_gc_free (p->putback_buf, p->putback_buf_size, "putback buffer");
-  if (p->encoding)
-    {
-      free (p->encoding);
-      p->encoding = NULL;
-    }
-  scm_gc_free (p, sizeof (scm_t_port), "port");
+
+  scm_port_non_buffer (p);
+
+  p->putback_buf = NULL;
+  p->putback_buf_size = 0;
 
   SCM_SETPTAB_ENTRY (port, 0);
   scm_hashq_remove_x (scm_i_port_weak_hash, port);
@@ -1498,8 +1495,6 @@ scm_unget_byte (int c, SCM port)
        {
          size_t new_size = pt->read_buf_size * 2;
          unsigned char *tmp = (unsigned char *)
-           /* XXX: Can we use `GC_REALLOC' with `GC_MALLOC_ATOMIC'-allocated
-              data?  (Ludo)  */
            scm_gc_realloc (pt->putback_buf, pt->read_buf_size, new_size,
                            "putback buffer");
 
@@ -2024,12 +2019,10 @@ scm_i_set_port_encoding_x (SCM port, const char *enc)
     {
       /* Set the character encoding for this port.  */
       pt = SCM_PTAB_ENTRY (port);
-      if (pt->encoding)
-       free (pt->encoding);
       if (valid_enc == NULL)
         pt->encoding = NULL;
       else
-        pt->encoding = strdup (valid_enc);
+        pt->encoding = scm_gc_strdup (valid_enc, "port");
     }
 }
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]