guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-22-g807196


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-22-g8071964
Date: Sun, 20 Nov 2011 00:11:10 +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=8071964943e23700cfe1095ba0f5e3c99f590dee

The branch, stable-2.0 has been updated
       via  8071964943e23700cfe1095ba0f5e3c99f590dee (commit)
      from  7f622b82a2ada4af1f78e27d1ef9ad1498305287 (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 8071964943e23700cfe1095ba0f5e3c99f590dee
Author: Ludovic Courtès <address@hidden>
Date:   Sun Nov 20 01:10:58 2011 +0100

    Allow overlapping regions to be passed to `bytevector-copy!'.
    
    Reported by Dmitry Chestnykh <address@hidden>.
    Fixes <http://debbugs.gnu.org/10070>.
    
    * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
      `memcpy'.
    
    * test-suite/tests/bytevectors.test ("2.2 General
      Operations")["bytevector-copy! overlapping"]: New test.
    
    * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
      overlapping.

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

Summary of changes:
 doc/ref/api-data.texi             |    3 ++-
 libguile/bytevectors.c            |    6 +++---
 test-suite/tests/bytevectors.test |   11 +++++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index f9b39b6..5017165 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -4546,7 +4546,8 @@ Fill bytevector @var{bv} with @var{fill}, a byte.
 @deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, 
target_start, len)
 Copy @var{len} bytes from @var{source} into @var{target}, starting
 reading from @var{source-start} (a positive index within @var{source})
-and start writing at @var{target-start}.
+and start writing at @var{target-start}.  It is permitted for the
address@hidden and @var{target} regions to overlap.
 @end deffn
 
 @deffn {Scheme Procedure} bytevector-copy bv
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 4aeae63..fff5355 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -579,9 +579,9 @@ SCM_DEFINE (scm_bytevector_copy_x, "bytevector-copy!", 5, 
0, 0,
   if (SCM_UNLIKELY (c_target_start + c_len > c_target_len))
     scm_out_of_range (FUNC_NAME, target_start);
 
-  memcpy (c_target + c_target_start,
-         c_source + c_source_start,
-         c_len);
+  memmove (c_target + c_target_start,
+          c_source + c_source_start,
+          c_len);
 
   return SCM_UNSPECIFIED;
 }
diff --git a/test-suite/tests/bytevectors.test 
b/test-suite/tests/bytevectors.test
index 081e4ee..3007434 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -1,6 +1,6 @@
 ;;;; bytevectors.test --- R6RS bytevectors. -*- mode: scheme; coding: utf-8; 
-*-
 ;;;;
-;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 ;;;; Ludovic Courtès
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
@@ -42,7 +42,14 @@
     (and (bytevector=? (make-bytevector 20 7)
                        (make-bytevector 20 7))
          (not (bytevector=? (make-bytevector 20 7)
-                            (make-bytevector 20 0))))))
+                            (make-bytevector 20 0)))))
+
+  (pass-if "bytevector-copy! overlapping"
+    ;; See <http://debbugs.gnu.org/10070>.
+    (let ((b (u8-list->bytevector '(1 2 3 4 5 6 7 8))))
+      (bytevector-copy! b 0 b 3 4)
+      (bytevector->u8-list b)
+      (bytevector=? b #vu8(1 2 3 1 2 3 4 8)))))
 
 
 (with-test-prefix/c&e "2.3 Operations on Bytes and Octets"


hooks/post-receive
-- 
GNU Guile



reply via email to

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