guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/libguile ChangeLog numbers.c r...


From: Dirk Herrmann
Subject: guile/guile-core/libguile ChangeLog numbers.c r...
Date: Fri, 06 Oct 2000 09:51:09 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Dirk Herrmann <address@hidden>  00/10/06 09:51:08

Modified files:
        guile-core/libguile: ChangeLog numbers.c read.c strports.c 

Log message:
        * Don't call scm_vector_set_length_x for non-vector arguments.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1134&r2=1.1135
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/numbers.c.diff?r1=1.103&r2=1.104
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/read.c.diff?r1=1.58&r2=1.59
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/strports.c.diff?r1=1.62&r2=1.63

Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1134 
guile/guile-core/libguile/ChangeLog:1.1135
--- guile/guile-core/libguile/ChangeLog:1.1134  Fri Oct  6 06:35:58 2000
+++ guile/guile-core/libguile/ChangeLog Fri Oct  6 09:51:07 2000
@@ -1,5 +1,14 @@
 2000-10-06  Dirk Herrmann  <address@hidden>
 
+       * numbers.c (big2str), read.c (scm_grow_tok_buf), strports.c
+       (st_resize_port):  Don't call scm_vector_set_length_x to resize
+       strings.
+
+       * read.c (scm_lreadr, scm_read_token):  Use SCM_STRING_LENGTH for
+       string arguments (instead of SCM_LENGTH).
+
+2000-10-06  Dirk Herrmann  <address@hidden>
+
        * continuations.h (SCM_CONTINUATION_LENGTH), strings.h
        (SCM_STRING_LENGTH), symbols.h (SCM_SYMBOL_LENGTH), unif.h
        (SCM_UVECTOR_LENGTH, SCM_BITVECTOR_LENGTH), vectors.h
Index: guile/guile-core/libguile/numbers.c
diff -u guile/guile-core/libguile/numbers.c:1.103 
guile/guile-core/libguile/numbers.c:1.104
--- guile/guile-core/libguile/numbers.c:1.103   Tue Sep 26 12:40:10 2000
+++ guile/guile-core/libguile/numbers.c Fri Oct  6 09:51:07 2000
@@ -52,7 +52,6 @@
 #include "libguile/root.h"
 #include "libguile/smob.h"
 #include "libguile/strings.h"
-#include "libguile/vectors.h"
 
 #include "libguile/validate.h"
 #include "libguile/numbers.h"
@@ -2205,8 +2204,8 @@
     {                          /* jeh */
       for (i = j; j < SCM_LENGTH (ss); j++)
        s[ch + j - i] = s[j];   /* jeh */
-      scm_vector_set_length_x (ss, /* jeh */
-                              SCM_MAKINUM (ch + SCM_LENGTH (ss) - i));
+      ss = scm_substring (ss, SCM_INUM0, 
+                         SCM_MAKINUM (ch + SCM_STRING_LENGTH (ss) - i));
     }
 
   return scm_return_first (ss, t);
Index: guile/guile-core/libguile/read.c
diff -u guile/guile-core/libguile/read.c:1.58 
guile/guile-core/libguile/read.c:1.59
--- guile/guile-core/libguile/read.c:1.58       Tue Sep 26 14:53:49 2000
+++ guile/guile-core/libguile/read.c    Fri Oct  6 09:51:08 2000
@@ -122,8 +122,15 @@
 char *
 scm_grow_tok_buf (SCM *tok_buf)
 {
-  scm_vector_set_length_x (*tok_buf, SCM_MAKINUM (2 * SCM_LENGTH (*tok_buf)));
-  return SCM_STRING_CHARS (*tok_buf);
+  unsigned long int oldlen = SCM_STRING_LENGTH (*tok_buf);
+  SCM newstr = scm_makstr (2 * oldlen, 0);
+  unsigned long int i;
+
+  for (i = 0; i != oldlen; ++i)
+    SCM_STRING_CHARS (newstr) [i] = SCM_STRING_CHARS (*tok_buf) [i];
+
+  *tok_buf = newstr;
+  return SCM_STRING_CHARS (newstr);
 }
 
 
@@ -434,7 +441,7 @@
        {
          SCM_ASSERT (EOF != c, SCM_UNDEFINED, "end of file in ", "string");
 
-         while (j + 2 >= SCM_LENGTH (*tok_buf))
+         while (j + 2 >= SCM_STRING_LENGTH (*tok_buf))
            scm_grow_tok_buf (tok_buf);
 
          if (c == '\\')
@@ -535,7 +542,7 @@
   else
     {
       j = 0;
-      while (j + 2 >= SCM_LENGTH (*tok_buf))
+      while (j + 2 >= SCM_STRING_LENGTH (*tok_buf))
        p = scm_grow_tok_buf (tok_buf);
       p[j] = c;
       ++j;
@@ -543,7 +550,7 @@
 
   while (1)
     {
-      while (j + 2 >= SCM_LENGTH (*tok_buf))
+      while (j + 2 >= SCM_STRING_LENGTH (*tok_buf))
        p = scm_grow_tok_buf (tok_buf);
       c = scm_getc (port);
       switch (c)
Index: guile/guile-core/libguile/strports.c
diff -u guile/guile-core/libguile/strports.c:1.62 
guile/guile-core/libguile/strports.c:1.63
--- guile/guile-core/libguile/strports.c:1.62   Tue Sep 26 15:15:13 2000
+++ guile/guile-core/libguile/strports.c        Fri Oct  6 09:51:08 2000
@@ -57,7 +57,6 @@
 #include "libguile/read.h"
 #include "libguile/root.h"
 #include "libguile/strings.h"
-#include "libguile/vectors.h"
 #include "libguile/modules.h"
 
 #include "libguile/strports.h"
@@ -96,17 +95,23 @@
 static void 
 st_resize_port (scm_port *pt, off_t new_size)
 {
-  SCM stream = SCM_PACK (pt->stream);
+  SCM old_stream = SCM_PACK (pt->stream);
+  SCM new_stream = scm_makstr (new_size, 0);
+  unsigned long int old_size = SCM_STRING_LENGTH (old_stream);
+  unsigned long int min_size = min (old_size, new_size);
+  unsigned long int i;
 
   off_t index = pt->write_pos - pt->write_buf;
 
   pt->write_buf_size = new_size;
 
-  scm_vector_set_length_x (stream, SCM_MAKINUM (new_size));
+  for (i = 0; i != min_size; ++i)
+    SCM_STRING_CHARS (new_stream) [i] = SCM_STRING_CHARS (old_stream) [i];
 
-  /* reset buffer in case reallocation moved the string. */
+  /* reset buffer. */
   {
-    pt->read_buf = pt->write_buf = SCM_STRING_UCHARS (stream);
+    pt->stream = new_stream;
+    pt->read_buf = pt->write_buf = SCM_STRING_UCHARS (new_stream);
     pt->read_pos = pt->write_pos = pt->write_buf + index;
     pt->write_end = pt->write_buf + pt->write_buf_size;
     pt->read_end = pt->read_buf + pt->read_buf_size;



reply via email to

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