#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include "rdd.h"
#include "alignedbuf.h"
Go to the source code of this file.
Functions | |
unsigned | rdd_abuf_get_alignment (RDD_ALIGNEDBUF *buf) |
Returns the alignment in bytes of an aligned buffer. | |
unsigned | rdd_abuf_get_size (RDD_ALIGNEDBUF *buf) |
Returns the size in bytes of an aligned buffer. | |
int | rdd_free_alignedbuf (RDD_ALIGNEDBUF *buf) |
Deallocates the data buffer associated with buf and invalidates both pointer fields in buf . | |
int | rdd_new_alignedbuf (RDD_ALIGNEDBUF *buf, unsigned bufsize, unsigned align) |
Allocates a buffer of sz bytes and returns two pointers in buf: a pointer to the buffer and a pointer that has been aligned to align bytes. | |
Variables | |
static char | copyright [] |
unsigned rdd_abuf_get_alignment | ( | RDD_ALIGNEDBUF * | buf | ) |
Returns the alignment in bytes of an aligned buffer.
buf | pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf() . |
Definition at line 104 of file alignedbuf.c.
References RDD_ALIGNEDBUF::align.
unsigned rdd_abuf_get_size | ( | RDD_ALIGNEDBUF * | buf | ) |
Returns the size in bytes of an aligned buffer.
buf | pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf() . |
Definition at line 98 of file alignedbuf.c.
References RDD_ALIGNEDBUF::asize.
int rdd_free_alignedbuf | ( | RDD_ALIGNEDBUF * | buf | ) |
Deallocates the data buffer associated with buf
and invalidates both pointer fields in buf
.
buf | pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf() . |
Definition at line 89 of file alignedbuf.c.
References RDD_OK, and RDD_ALIGNEDBUF::unaligned.
int rdd_new_alignedbuf | ( | RDD_ALIGNEDBUF * | buf, | |
unsigned | sz, | |||
unsigned | align | |||
) |
Allocates a buffer of sz
bytes and returns two pointers in buf:
a pointer to the buffer and a pointer that has been aligned to align
bytes.
buf | pointer to an RDD_ALIGNEDBUF structure allocated by the client. | |
sz | size in bytes of the data buffer that will be allocated; there will be at least sz bytes of free space in the aligned buffer. | |
align | alignment in bytes. |
RDD_OK
on success. Returns RDD_NOMEM
if there is insufficient memory to allocate the buffer. Returns RDD_BADARG
if a bad alignment argument is given. Definition at line 57 of file alignedbuf.c.
References RDD_ALIGNEDBUF::align, RDD_ALIGNEDBUF::aligned, RDD_ALIGNEDBUF::asize, RDD_BADARG, RDD_NOMEM, RDD_OK, and RDD_ALIGNEDBUF::unaligned.
char copyright[] [static] |
Initial value:
"@(#) Copyright (c) 2002\n\ Netherlands Forensic Institute. All rights reserved.\n"
Definition at line 40 of file alignedbuf.c.