diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-06-21 16:55:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-06-22 01:00:41 +0200 |
commit | 2d34e9244b8b35f62d086a88db749718a2a1a3b4 (patch) | |
tree | 23ae7d081cc0fa1f0e3a8fd1baa8a2b9df13b4a6 | |
parent | d64fc8b039fd686a5f8f33458ba1193dc584b2a9 (diff) | |
download | guile-2d34e9244b8b35f62d086a88db749718a2a1a3b4.tar.gz |
bytevectors: Use `size_t' rather than `unsigned' for sizes.
* doc/ref/api-data.texi (Bytevector Manipulation): Update.
* libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE,
make_bytevector_from_buffer, scm_c_make_bytevector,
scm_c_take_bytevector, scm_i_shrink_bytevector): Use `size_t' for
bytevector lengths.
-rwxr-xr-x | doc/ref/api-data.texi | 2 | ||||
-rw-r--r-- | libguile/bytevectors.c | 14 | ||||
-rw-r--r-- | libguile/bytevectors.h | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 78d4ea27b..eb059d329 100755 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -3837,7 +3837,7 @@ procedures. @deffn {Scheme Procedure} make-bytevector len [fill] @deffnx {C Function} scm_make_bytevector (len, fill) -@deffnx {C Function} scm_c_make_bytevector (unsigned len) +@deffnx {C Function} scm_c_make_bytevector (size_t len) Return a new bytevector of @var{len} bytes. Optionally, if @var{fill} is given, fill it with @var{fill}; @var{fill} must be in the range [-128,255]. diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index 2484a64a4..83058ba0b 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -74,7 +74,7 @@ #define INTEGER_ACCESSOR_PROLOGUE(_len, _sign) \ - unsigned c_len, c_index; \ + size_t c_len, c_index; \ _sign char *c_bv; \ \ SCM_VALIDATE_BYTEVECTOR (1, bv); \ @@ -184,14 +184,14 @@ SCM scm_null_bytevector = SCM_UNSPECIFIED; static inline SCM -make_bytevector_from_buffer (unsigned len, signed char *contents) +make_bytevector_from_buffer (size_t len, signed char *contents) { /* Assuming LEN > SCM_BYTEVECTOR_INLINE_THRESHOLD. */ SCM_RETURN_NEWSMOB2 (scm_tc16_bytevector, len, contents); } static inline SCM -make_bytevector (unsigned len) +make_bytevector (size_t len) { SCM bv; @@ -212,7 +212,7 @@ make_bytevector (unsigned len) /* Return a new bytevector of size LEN octets. */ SCM -scm_c_make_bytevector (unsigned len) +scm_c_make_bytevector (size_t len) { return (make_bytevector (len)); } @@ -220,7 +220,7 @@ scm_c_make_bytevector (unsigned len) /* Return a bytevector of size LEN made up of CONTENTS. The area pointed to by CONTENTS must have been allocated using `scm_gc_malloc ()'. */ SCM -scm_c_take_bytevector (signed char *contents, unsigned len) +scm_c_take_bytevector (signed char *contents, size_t len) { SCM bv; @@ -243,11 +243,11 @@ scm_c_take_bytevector (signed char *contents, unsigned len) /* Shrink BV to C_NEW_LEN (which is assumed to be smaller than its current size) and return BV. */ SCM -scm_i_shrink_bytevector (SCM bv, unsigned c_new_len) +scm_i_shrink_bytevector (SCM bv, size_t c_new_len) { if (!SCM_BYTEVECTOR_INLINE_P (bv)) { - unsigned c_len; + size_t c_len; signed char *c_bv, *c_new_bv; c_len = SCM_BYTEVECTOR_LENGTH (bv); diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h index 4b1b60660..208147627 100644 --- a/libguile/bytevectors.h +++ b/libguile/bytevectors.h @@ -27,7 +27,7 @@ /* R6RS bytevectors. */ #define SCM_BYTEVECTOR_LENGTH(_bv) \ - ((unsigned) SCM_SMOB_DATA (_bv)) + ((size_t) SCM_SMOB_DATA (_bv)) #define SCM_BYTEVECTOR_CONTENTS(_bv) \ (SCM_BYTEVECTOR_INLINE_P (_bv) \ ? (signed char *) SCM_SMOB_OBJECT_2_LOC (_bv) \ @@ -38,7 +38,7 @@ SCM_API SCM scm_endianness_big; SCM_API SCM scm_endianness_little; SCM_API SCM scm_make_bytevector (SCM, SCM); -SCM_API SCM scm_c_make_bytevector (unsigned); +SCM_API SCM scm_c_make_bytevector (size_t); SCM_API SCM scm_native_endianness (void); SCM_API SCM scm_bytevector_p (SCM); SCM_API SCM scm_bytevector_length (SCM); @@ -123,14 +123,14 @@ SCM_API SCM scm_utf32_to_string (SCM, SCM); SCM_API void scm_init_bytevectors (void); SCM_INTERNAL scm_t_bits scm_tc16_bytevector; -SCM_INTERNAL SCM scm_c_take_bytevector (signed char *, unsigned); +SCM_INTERNAL SCM scm_c_take_bytevector (signed char *, size_t); #define scm_c_shrink_bytevector(_bv, _len) \ (SCM_BYTEVECTOR_INLINE_P (_bv) \ ? (_bv) \ : scm_i_shrink_bytevector ((_bv), (_len))) -SCM_INTERNAL SCM scm_i_shrink_bytevector (SCM, unsigned); +SCM_INTERNAL SCM scm_i_shrink_bytevector (SCM, size_t); SCM_INTERNAL SCM scm_null_bytevector; #endif /* SCM_BYTEVECTORS_H */ |