File: rarray_new.pod

package info (click to toggle)
roy 1.0.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,316 kB
  • ctags: 1,564
  • sloc: ansic: 14,459; sh: 8,259; makefile: 322
file content (50 lines) | stat: -rw-r--r-- 1,596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


=head1 NAME

rarray_new - allocate and initialize a new Roy array.

rarray_free - free storage of Roy array.

=head1 SYNOPSIS

#include <roy.h>

RArray * rarray_new (unsigned int I<element_size>, unsigned int I<elements_per_chunk>);

void rarray_free (RArray *I<array>);

=head1 DESCRIPTION

rarray_new(3) creates a new Roy array, allocating the first contigious
chunk of memory of size I<element_size> * I<elements_per_chunk>.
I<element_size> should be the size of the element in bytes, and 
I<elements_per_chunk> is the number of elements to allocate at a time.
These parameters determine how large the contigious blocks of memory
are.  Once your array grows past the end of the current block, a new block
of this size is allocated, and appended to the array.

If the array is shrunk in any manner, the blocks are not freed, instead, they
are left around in case of later expansion.  The blocks are only freed when
rarray_free(3) is called.

rarray_free(3) frees I<array>, and all of the blocks in the array.  This
effectively frees all elements of the array.

=head1 RETURN VALUE

rarray_new(3) returns a pointer to a new RArray.
rarray_free(3) does not return a value.

=head1 ERRORS

These calls produce no errors.

=head1 SEE ALSO

L<rarray(3)|rarray(3)>, L<rarray_append(3)|rarray_append(3)>, 
L<rarray_free(3)|rarray_free(3)>, L<rarray_last(3)|rarray_last(3)>, 
L<rarray_len(3)|rarray_len(3)>, L<rarray_nth(3)|rarray_nth(3)>, 
L<rarray_peek(3)|rarray_peek(3)>, L<rarray_pop(3)|rarray_pop(3)>, 
L<rarray_push(3)|rarray_push(3)>, L<rarray_set_len(3)|rarray_set_len(3)>, 
L<roy(3)|roy(3)>