Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Beta/JString.c File Reference

#include <j2k/Fred/fast_alloc.c>

Go to the source code of this file.

Compounds

struct  _JString_t
struct  _JSubString_t

Defines

#define JSTRING_SIZE   ( sizeof( JString_t ) )
#define JSUBSTRING_SIZE   ( sizeof( JSubString_t ) )
#define JSTRING_INIT   { 0, 0, 1, 0, { 0 } }
#define JSUBSTRING_INIT   { 0, 0, 0, 0 }

Typedefs

typedef _JString_t JString_t
typedef _JSubString_t JSubString_t

Functions

JString_tJString_malloc (register size_t buffer_size)
JString_tJString_calloc (register size_t buffer_size)
void JString_free (JString_t *this)
JString_tJString_create (const char *str, register size_t length, register size_t buffer_size)
JString_tJString_safe_create (const char *str)


Define Documentation

#define JSTRING_INIT   { 0, 0, 1, 0, { 0 } }
 

Definition at line 47 of file JString.c.

#define JSTRING_SIZE   ( sizeof( JString_t ) )
 

Definition at line 44 of file JString.c.

#define JSUBSTRING_INIT   { 0, 0, 0, 0 }
 

Definition at line 48 of file JString.c.

#define JSUBSTRING_SIZE   ( sizeof( JSubString_t ) )
 

Definition at line 45 of file JString.c.


Typedef Documentation

typedef struct _JString_t JString_t
 

typedef struct _JSubString_t JSubString_t
 


Function Documentation

JString_t* JString_calloc register size_t    buffer_size
 

Definition at line 59 of file JString.c.

Referenced by JString_create().

00060 {
00061   buffer_size += sizeof( JString_t );
00062   JString_t* s = (JString_t*)fast_malloc( buffer_size );
00063   memset( s, 0, buffer_size );
00064   s->nbRefs = 1;
00065   return s;
00066 }

JString_t* JString_create const char *    str,
register size_t    length,
register size_t    buffer_size
 

Definition at line 78 of file JString.c.

Referenced by JString_safe_create().

00079 {
00080   /* Make sure the buffer size is at least the length */
00081   if ( buffer_size < length ) 
00082   {
00083     buffer_size = length;
00084   }
00085 
00086   JString_t* s = JString_calloc( buffer_size );
00087 
00088   if ( str != NULL )
00089   {
00090     memcpy( s->data, str, length );
00091   }
00092 
00093   return s;
00094 }

void JString_free JString_t   this
 

Definition at line 68 of file JString.c.

00069 {
00070   /* delete if not used and unlock */
00071   if( --this->nbRefs <= 0  &&  this->lock == 0 )
00072   {
00073     free( this );
00074   }
00075 }

JString_t* JString_malloc register size_t    buffer_size
 

Definition at line 53 of file JString.c.

00054 {
00055   buffer_size += sizeof( JString_t );
00056   return (JString_t*)fast_malloc( buffer_size );
00057 }

JString_t* JString_safe_create const char *    str
 

Definition at line 96 of file JString.c.

00097 {
00098   return JString_create( str, strlen( str ), 80 ); 
00099 }


Generated on Sun Oct 14 18:46:55 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001