mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +02:00
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.
This commit is contained in:
parent
d64fc8b039
commit
2d34e9244b
3 changed files with 12 additions and 12 deletions
|
@ -3837,7 +3837,7 @@ procedures.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} make-bytevector len [fill]
|
@deffn {Scheme Procedure} make-bytevector len [fill]
|
||||||
@deffnx {C Function} scm_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}
|
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
|
is given, fill it with @var{fill}; @var{fill} must be in the range
|
||||||
[-128,255].
|
[-128,255].
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define INTEGER_ACCESSOR_PROLOGUE(_len, _sign) \
|
#define INTEGER_ACCESSOR_PROLOGUE(_len, _sign) \
|
||||||
unsigned c_len, c_index; \
|
size_t c_len, c_index; \
|
||||||
_sign char *c_bv; \
|
_sign char *c_bv; \
|
||||||
\
|
\
|
||||||
SCM_VALIDATE_BYTEVECTOR (1, bv); \
|
SCM_VALIDATE_BYTEVECTOR (1, bv); \
|
||||||
|
@ -184,14 +184,14 @@ SCM scm_null_bytevector = SCM_UNSPECIFIED;
|
||||||
|
|
||||||
|
|
||||||
static inline SCM
|
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. */
|
/* Assuming LEN > SCM_BYTEVECTOR_INLINE_THRESHOLD. */
|
||||||
SCM_RETURN_NEWSMOB2 (scm_tc16_bytevector, len, contents);
|
SCM_RETURN_NEWSMOB2 (scm_tc16_bytevector, len, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SCM
|
static inline SCM
|
||||||
make_bytevector (unsigned len)
|
make_bytevector (size_t len)
|
||||||
{
|
{
|
||||||
SCM bv;
|
SCM bv;
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ make_bytevector (unsigned len)
|
||||||
|
|
||||||
/* Return a new bytevector of size LEN octets. */
|
/* Return a new bytevector of size LEN octets. */
|
||||||
SCM
|
SCM
|
||||||
scm_c_make_bytevector (unsigned len)
|
scm_c_make_bytevector (size_t len)
|
||||||
{
|
{
|
||||||
return (make_bytevector (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
|
/* Return a bytevector of size LEN made up of CONTENTS. The area pointed to
|
||||||
by CONTENTS must have been allocated using `scm_gc_malloc ()'. */
|
by CONTENTS must have been allocated using `scm_gc_malloc ()'. */
|
||||||
SCM
|
SCM
|
||||||
scm_c_take_bytevector (signed char *contents, unsigned len)
|
scm_c_take_bytevector (signed char *contents, size_t len)
|
||||||
{
|
{
|
||||||
SCM bv;
|
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
|
/* Shrink BV to C_NEW_LEN (which is assumed to be smaller than its current
|
||||||
size) and return BV. */
|
size) and return BV. */
|
||||||
SCM
|
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))
|
if (!SCM_BYTEVECTOR_INLINE_P (bv))
|
||||||
{
|
{
|
||||||
unsigned c_len;
|
size_t c_len;
|
||||||
signed char *c_bv, *c_new_bv;
|
signed char *c_bv, *c_new_bv;
|
||||||
|
|
||||||
c_len = SCM_BYTEVECTOR_LENGTH (bv);
|
c_len = SCM_BYTEVECTOR_LENGTH (bv);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
/* R6RS bytevectors. */
|
/* R6RS bytevectors. */
|
||||||
|
|
||||||
#define SCM_BYTEVECTOR_LENGTH(_bv) \
|
#define SCM_BYTEVECTOR_LENGTH(_bv) \
|
||||||
((unsigned) SCM_SMOB_DATA (_bv))
|
((size_t) SCM_SMOB_DATA (_bv))
|
||||||
#define SCM_BYTEVECTOR_CONTENTS(_bv) \
|
#define SCM_BYTEVECTOR_CONTENTS(_bv) \
|
||||||
(SCM_BYTEVECTOR_INLINE_P (_bv) \
|
(SCM_BYTEVECTOR_INLINE_P (_bv) \
|
||||||
? (signed char *) SCM_SMOB_OBJECT_2_LOC (_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_endianness_little;
|
||||||
|
|
||||||
SCM_API SCM scm_make_bytevector (SCM, SCM);
|
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_native_endianness (void);
|
||||||
SCM_API SCM scm_bytevector_p (SCM);
|
SCM_API SCM scm_bytevector_p (SCM);
|
||||||
SCM_API SCM scm_bytevector_length (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_API void scm_init_bytevectors (void);
|
||||||
|
|
||||||
SCM_INTERNAL scm_t_bits scm_tc16_bytevector;
|
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) \
|
#define scm_c_shrink_bytevector(_bv, _len) \
|
||||||
(SCM_BYTEVECTOR_INLINE_P (_bv) \
|
(SCM_BYTEVECTOR_INLINE_P (_bv) \
|
||||||
? (_bv) \
|
? (_bv) \
|
||||||
: scm_i_shrink_bytevector ((_bv), (_len)))
|
: 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;
|
SCM_INTERNAL SCM scm_null_bytevector;
|
||||||
|
|
||||||
#endif /* SCM_BYTEVECTORS_H */
|
#endif /* SCM_BYTEVECTORS_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue