void
alloccopy( unsigned char ** ptr, unsigned char * data, \
int data_len, int * pos )
{
if ( data_len == 0 || data == NULL )
return;
else if ( * ptr == NULL )
{
* ptr = (unsigned char *)malloc( data_len );
memcpy( * ptr, data, data_len );
* pos = data_len;
}
else
{
* ptr = (unsigned char *)realloc( * ptr, * pos + data_len );
memcpy( ( * ptr ) + * pos, data, data_len );
* pos = * pos + data_len;
}
return;
}
阅读(665) | 评论(0) | 转发(0) |