Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

nsrealloc.h File Reference

Go to the source code of this file.

Functions

NSByteHoldernewNSByteHolder (void)
 Creates a new NSByteHolder to dynamical store an arbitrary number of bytes.

void addCharacter (struct NSByteHolder *nsb, char c)
 Adds a single character to a struct NSByteHolder.

void addBlock (struct NSByteHolder *nsb, char *buf, int len)
 Adds a block of bytes to a struct NSByteHolder.

int getSize (struct NSByteHolder *nsb)
 Returns the number of bytes added to this struct NSByteHolder.

const char * getData (struct NSByteHolder *nsb)
 Returns a pointer to a contiguous block of data held by nsb.

void freeNSByteHolder (struct NSByteHolder *nsb)
 Frees the resources associated with a struct NSByteHolder.


Detailed Description

Author:
Rudi Cilibrasi

Definition in file nsrealloc.h.


Function Documentation

void addBlock struct NSByteHolder nsb,
char *  buf,
int  len
 

Adds a block of bytes to a struct NSByteHolder.

Parameters:
nsb a pointer to a struct NSByteHolder
buf a pointer to the start address of the block to add
len the number of bytes in the block to add

Definition at line 39 of file nsrealloc.c.

References addCharacter(), and buf.

void addCharacter struct NSByteHolder nsb,
char  c
 

Adds a single character to a struct NSByteHolder.

Parameters:
nsb a pointer to a struct NSByteHolder
c the character to add to the end of the data block.

Definition at line 46 of file nsrealloc.c.

References NSByteHolder::buf, and NSByteHolder::used.

Referenced by addBlock().

void freeNSByteHolder struct NSByteHolder nsb  ) 
 

Frees the resources associated with a struct NSByteHolder.

Parameters:
nsb The struct NSByteHolder to deallocate.

Definition at line 63 of file nsrealloc.c.

References NSByteHolder::alloc, NSByteHolder::buf, and NSByteHolder::used.

const char* getData struct NSByteHolder nsb  ) 
 

Returns a pointer to a contiguous block of data held by nsb.

Parameters:
nsb The struct NSByteHolder to query.
Returns:
A pointer to data accumulated into the struct NSByteHolder
This function returns a pointer to the start of the data being held by nsb. This data will come from addCharacter() or addBlock() calls that have previously occurred.

Definition at line 58 of file nsrealloc.c.

References NSByteHolder::buf.

int getSize struct NSByteHolder nsb  ) 
 

Returns the number of bytes added to this struct NSByteHolder.

Parameters:
nsb The struct NSByteHolder to query.
Returns:
the number of bytes added to this struct NSByteHolder

Definition at line 53 of file nsrealloc.c.

References NSByteHolder::used.

struct NSByteHolder* newNSByteHolder void   ) 
 

Creates a new NSByteHolder to dynamical store an arbitrary number of bytes.

Returns:
a pointer to a struct NSByteHolder. Note that the initial struct NSByteHolder will contain 0 bytes.

Definition at line 29 of file nsrealloc.c.

References STARTINGBUFSIZE.


Generated on Tue Feb 8 00:05:19 2005 for Neuroserver by doxygen 1.3.3