Scheme Programmer's Manual

NAME

bytevector-fill! - fill a bytevector with a value

LIBRARY

(import (rnrs))                     ;R6RS
(import (rnrs bytevectors))         ;R6RS

SYNOPSIS

(bytevector-fill! bytevector fill)

DESCRIPTION

This procedure stores fill in every element of bytevector. The fill value is an exact integer in the interval [-128, 255]. Negative fill values are interpreted as bytes, viz.:
  (bytevector-fill! bytevector (bitwise-and fill #xff))

RETURN VALUES

Returns unspecified values.

EXAMPLES

(let ((a (u8-list->bytevector '(1 2 3))))
  (bytevector-fill! a 0)
  a)
   => #vu8(0 0 0)

APPLICATION USAGE

This procedure is sometimes useful to clear sensitive parts of memory, like bytevectors holding cryptographic keys. This is optimistic but is not in any way guaranteed to wipe the data from memory.

A bytevector that contains the specified value would normally be created from scratch with make-bytevector(3).

COMPATIBILITY

The only difference in behavior between implementations should be in how fast it runs. This procedure is not present in R7RS-small.

ERRORS

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.

SEE ALSO

vector-fill!(3), make-bytevector(3)

STANDARDS

R6RS

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUES
EXAMPLES
APPLICATION USAGE
COMPATIBILITY
ERRORS
SEE ALSO
STANDARDS
AUTHORS
Return to Main Contents