mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* Replace function scm_makstr with new function scm_allocate_string.
This commit is contained in:
parent
3b9e23a7b6
commit
be54b15d85
12 changed files with 66 additions and 20 deletions
8
NEWS
8
NEWS
|
@ -520,6 +520,14 @@ These functions replace the function scm_remember.
|
|||
Use one of the new functions scm_remember_upto_here_1,
|
||||
scm_remember_upto_here_2 or scm_remember_upto_here instead.
|
||||
|
||||
** New function: scm_allocate_string
|
||||
|
||||
This function replaces the function scm_makstr.
|
||||
|
||||
** Deprecated function: scm_makstr
|
||||
|
||||
Use the new function scm_allocate_string instead.
|
||||
|
||||
** New global variable scm_gc_running_p introduced.
|
||||
|
||||
Use this variable to find out if garbage collection is being executed. Up to
|
||||
|
|
1
RELEASE
1
RELEASE
|
@ -47,6 +47,7 @@ In release 1.6:
|
|||
load.c: scm_read_and_eval_x
|
||||
smob.c: scm_make_smob_type_mfpe, scm_set_smob_mfpe
|
||||
gc.c: scm_remember
|
||||
string.c: scm_makstr
|
||||
- remove deprecated procedures:
|
||||
boot-9.scm:eval-in-module
|
||||
- remove deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
2001-03-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* gc.c (scm_init_storage), gdbint.c (scm_init_gdbint), numbers.c
|
||||
(big2str), ports.c (scm_drain_input), read.c (scm_read,
|
||||
scm_grow_tok_buf), strings.c (scm_string, scm_makfromstr,
|
||||
scm_make_string, scm_string_append), strports.c (st_resize_port,
|
||||
scm_object_to_string), unif.c (scm_make_uve): Replace calls to
|
||||
scm_makstr with calls to scm_allocate_string.
|
||||
|
||||
* strings.[ch] (scm_allocate_string): New function.
|
||||
|
||||
* strings.[ch] (scm_makstr): Deprecated.
|
||||
|
||||
2001-03-18 Gary Houston <ghouston@arglist.com>
|
||||
|
||||
* posix.c (scm_tmpnam): check that return value from tmpnam is not
|
||||
|
|
|
@ -2630,7 +2630,7 @@ scm_init_storage ()
|
|||
SCM_SETCDR (scm_undefineds, scm_undefineds);
|
||||
|
||||
scm_listofnull = scm_cons (SCM_EOL, SCM_EOL);
|
||||
scm_nullstr = scm_makstr (0L, 0);
|
||||
scm_nullstr = scm_allocate_string (0);
|
||||
scm_nullvect = scm_c_make_vector (0, SCM_UNDEFINED);
|
||||
|
||||
#define DEFAULT_SYMHASH_SIZE 277
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GDB interface for Guile
|
||||
* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation
|
||||
* Copyright (C) 1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -329,7 +329,7 @@ scm_init_gdbint ()
|
|||
s);
|
||||
gdb_input_port = scm_permanent_object (port);
|
||||
|
||||
tok_buf = scm_permanent_object (scm_makstr (30L, 0));
|
||||
tok_buf = scm_permanent_object (scm_allocate_string (30));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -2244,7 +2244,7 @@ big2str (SCM b, unsigned int radix)
|
|||
scm_sizet k = 0;
|
||||
scm_sizet radct = 0;
|
||||
SCM_BIGDIG radpow = 1, radmod = 0;
|
||||
SCM ss = scm_makstr ((long) j, 0);
|
||||
SCM ss = scm_allocate_string (j);
|
||||
char *s = SCM_STRING_CHARS (ss), c;
|
||||
while ((long) radpow * radix < SCM_BIGRAD)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1997,1998,1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -322,7 +322,7 @@ SCM_DEFINE (scm_drain_input, "drain-input", 1, 0, 0,
|
|||
if (pt->read_buf == pt->putback_buf)
|
||||
count += pt->saved_read_end - pt->saved_read_pos;
|
||||
|
||||
result = scm_makstr (count, 0);
|
||||
result = scm_allocate_string (count);
|
||||
scm_take_from_input_buffers (port, SCM_STRING_CHARS (result), count);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -116,7 +116,7 @@ SCM_DEFINE (scm_read, "read", 0, 1, 0,
|
|||
return SCM_EOF_VAL;
|
||||
scm_ungetc (c, port);
|
||||
|
||||
tok_buf = scm_makstr (30L, 0);
|
||||
tok_buf = scm_allocate_string (30);
|
||||
return scm_lreadr (&tok_buf, port, ©);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -127,7 +127,7 @@ char *
|
|||
scm_grow_tok_buf (SCM *tok_buf)
|
||||
{
|
||||
unsigned long int oldlen = SCM_STRING_LENGTH (*tok_buf);
|
||||
SCM newstr = scm_makstr (2 * oldlen, 0);
|
||||
SCM newstr = scm_allocate_string (2 * oldlen);
|
||||
unsigned long int i;
|
||||
|
||||
for (i = 0; i != oldlen; ++i)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1998,2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1998,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -106,7 +106,7 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1,
|
|||
long i = scm_ilength (chrs);
|
||||
|
||||
SCM_ASSERT (i >= 0, chrs, SCM_ARGn, FUNC_NAME);
|
||||
result = scm_makstr (i, 0);
|
||||
result = scm_allocate_string (i);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -125,6 +125,7 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#if (SCM_DEBUG_DEPRECATED == 0)
|
||||
|
||||
SCM
|
||||
scm_makstr (long len, int dummy)
|
||||
|
@ -146,6 +147,7 @@ scm_makstr (long len, int dummy)
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#endif /* SCM_DEBUG_DEPRECATED == 0 */
|
||||
|
||||
/* converts C scm_array of strings to SCM scm_list of strings. */
|
||||
/* If argc < 0, a null terminated scm_array is assumed. */
|
||||
|
@ -199,7 +201,7 @@ scm_take0str (char *s)
|
|||
SCM
|
||||
scm_makfromstr (const char *src, scm_sizet len, int dummy)
|
||||
{
|
||||
SCM s = scm_makstr (len, 0);
|
||||
SCM s = scm_allocate_string (len);
|
||||
char *dst = SCM_STRING_CHARS (s);
|
||||
|
||||
while (len--)
|
||||
|
@ -222,6 +224,27 @@ scm_makfrom0str_opt (const char *src)
|
|||
}
|
||||
|
||||
|
||||
SCM
|
||||
scm_allocate_string (scm_sizet len)
|
||||
#define FUNC_NAME "scm_allocate_string"
|
||||
{
|
||||
char *mem;
|
||||
SCM s;
|
||||
|
||||
SCM_ASSERT_RANGE (1, scm_long2num (len), len <= SCM_STRING_MAX_LENGTH);
|
||||
|
||||
mem = (char *) scm_must_malloc (len + 1, FUNC_NAME);
|
||||
mem[len] = 0;
|
||||
|
||||
SCM_NEWCELL (s);
|
||||
SCM_SET_STRING_CHARS (s, mem);
|
||||
SCM_SET_STRING_LENGTH (s, len);
|
||||
|
||||
return s;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0,
|
||||
(SCM k, SCM chr),
|
||||
"Return a newly allocated string of\n"
|
||||
|
@ -237,7 +260,7 @@ SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0,
|
|||
|
||||
SCM_ASSERT_RANGE (1, k, i >= 0);
|
||||
|
||||
res = scm_makstr (i, 0);
|
||||
res = scm_allocate_string (i);
|
||||
if (!SCM_UNBNDP (chr))
|
||||
{
|
||||
unsigned char *dst;
|
||||
|
@ -348,7 +371,7 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
|
|||
SCM_VALIDATE_STRING (SCM_ARGn,s);
|
||||
i += SCM_STRING_LENGTH (s);
|
||||
}
|
||||
res = scm_makstr (i, 0);
|
||||
res = scm_allocate_string (i);
|
||||
data = SCM_STRING_UCHARS (res);
|
||||
for (l = args;SCM_NIMP (l);l = SCM_CDR (l)) {
|
||||
s = SCM_CAR (l);
|
||||
|
|
|
@ -70,13 +70,13 @@
|
|||
extern SCM scm_string_p (SCM x);
|
||||
extern SCM scm_read_only_string_p (SCM x);
|
||||
extern SCM scm_string (SCM chrs);
|
||||
extern SCM scm_makstr (long len, int);
|
||||
extern SCM scm_makfromstrs (int argc, char **argv);
|
||||
extern SCM scm_take_str (char *s, int len);
|
||||
extern SCM scm_take0str (char *s);
|
||||
extern SCM scm_makfromstr (const char *src, scm_sizet len, int);
|
||||
extern SCM scm_makfrom0str (const char *src);
|
||||
extern SCM scm_makfrom0str_opt (const char *src);
|
||||
extern SCM scm_allocate_string (scm_sizet len);
|
||||
extern SCM scm_make_string (SCM k, SCM chr);
|
||||
extern SCM scm_string_length (SCM str);
|
||||
extern SCM scm_string_ref (SCM str, SCM k);
|
||||
|
@ -102,6 +102,7 @@ extern void scm_init_strings (void);
|
|||
? (char *) SCM_CELL_WORD_1 (SCM_CDDR (x)) + SCM_INUM (SCM_CADR (x)) \
|
||||
: (char *) SCM_CELL_WORD_1 (x))
|
||||
extern SCM scm_make_shared_substring (SCM str, SCM frm, SCM to);
|
||||
extern SCM scm_makstr (long len, int);
|
||||
|
||||
#endif /* SCM_DEBUG_DEPRECATED == 0 */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1998,1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -100,7 +100,7 @@ static void
|
|||
st_resize_port (scm_port *pt, off_t new_size)
|
||||
{
|
||||
SCM old_stream = SCM_PACK (pt->stream);
|
||||
SCM new_stream = scm_makstr (new_size, 0);
|
||||
SCM new_stream = scm_allocate_string (new_size);
|
||||
unsigned long int old_size = SCM_STRING_LENGTH (old_stream);
|
||||
unsigned long int min_size = min (old_size, new_size);
|
||||
unsigned long int i;
|
||||
|
@ -323,7 +323,7 @@ SCM_DEFINE (scm_object_to_string, "object->string", 1, 1, 0,
|
|||
if (!SCM_UNBNDP (printer))
|
||||
SCM_VALIDATE_PROC (2, printer);
|
||||
|
||||
str = scm_makstr (0, 0);
|
||||
str = scm_allocate_string (0);
|
||||
port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_WRTNG, FUNC_NAME);
|
||||
|
||||
if (SCM_UNBNDP (printer))
|
||||
|
|
|
@ -186,7 +186,7 @@ scm_make_uve (long k, SCM prot)
|
|||
else if (SCM_CHARP (prot))
|
||||
{
|
||||
i = sizeof (char) * k;
|
||||
return scm_makstr (i, 0);
|
||||
return scm_allocate_string (i);
|
||||
}
|
||||
else if (SCM_INUMP (prot))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue