Logo Search packages:      
Sourcecode: libical version File versions  Download package

void icalmemory_append_char ( char **  buf,
char **  pos,
size_t *  buf_size,
char  ch 
)

icalmemory_append_char is similar, but is appends a character instead of a string

Definition at line 336 of file icalmemory.c.

{
    char *new_buf;
    char *new_pos;

    size_t data_length, final_length;

#ifndef ICAL_NO_INTERNAL_DEBUG
    icalerror_check_arg_rv( (buf!=0),"buf");
    icalerror_check_arg_rv( (*buf!=0),"*buf");
    icalerror_check_arg_rv( (pos!=0),"pos");
    icalerror_check_arg_rv( (*pos!=0),"*pos");
    icalerror_check_arg_rv( (buf_size!=0),"buf_size");
    icalerror_check_arg_rv( (*buf_size!=0),"*buf_size");
#endif

    data_length = (size_t)*pos - (size_t)*buf;

    final_length = data_length + 2; 

    if ( final_length > (size_t) *buf_size ) {

      
      *buf_size  = (*buf_size) * 2  + final_length +1;

      new_buf = realloc(*buf,*buf_size);

      new_pos = (void*)((size_t)new_buf + data_length);
      
      *pos = new_pos;
      *buf = new_buf;
    }

    **pos = ch;
    *pos += 1;
    **pos = 0;
}


Generated by  Doxygen 1.6.0   Back to index