diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-07-23 15:43:02 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-07-23 15:43:02 +0000 |
commit | e11e83f3d99305ada6354cae7123fb8c0e998703 (patch) | |
tree | 23dccd2a0fd1741abb8561214acadc347036480b /libguile/strings.c | |
parent | 928e0f421070bb610f3375d5808a6378d5edfa1b (diff) | |
download | guile-e11e83f3d99305ada6354cae7123fb8c0e998703.tar.gz |
* deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP
and SCM_I_INUM, respectively and adding deprecated versions to
deprecated.h and deprecated.c. Changed all uses to either use the
SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
Diffstat (limited to 'libguile/strings.c')
-rw-r--r-- | libguile/strings.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/libguile/strings.c b/libguile/strings.c index ad8486c1d..8d6b8b7b0 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -183,30 +183,20 @@ SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0, "of the @var{string} are unspecified.") #define FUNC_NAME s_scm_make_string { - if (SCM_INUMP (k)) - { - long int i = SCM_INUM (k); - SCM res; - - SCM_ASSERT_RANGE (1, k, i >= 0); - - res = scm_allocate_string (i); - if (!SCM_UNBNDP (chr)) - { - unsigned char *dst; - - SCM_VALIDATE_CHAR (2, chr); - - dst = SCM_STRING_UCHARS (res); - memset (dst, SCM_CHAR (chr), i); - } + size_t i = scm_to_unsigned_integer (k, 0, SCM_STRING_MAX_LENGTH); + SCM res = scm_allocate_string (i); - return res; + if (!SCM_UNBNDP (chr)) + { + unsigned char *dst; + + SCM_VALIDATE_CHAR (2, chr); + + dst = SCM_STRING_UCHARS (res); + memset (dst, SCM_CHAR (chr), i); } - else if (SCM_BIGP (k)) - SCM_OUT_OF_RANGE (1, k); - else - SCM_WRONG_TYPE_ARG (1, k); + + return res; } #undef FUNC_NAME @@ -217,7 +207,7 @@ SCM_DEFINE (scm_string_length, "string-length", 1, 0, 0, #define FUNC_NAME s_scm_string_length { SCM_VALIDATE_STRING (1, string); - return SCM_I_MAKINUM (SCM_STRING_LENGTH (string)); + return scm_from_size_t (SCM_STRING_LENGTH (string)); } #undef FUNC_NAME |