ext/iodine/fio.c
/** Used internally by the Set object to create a new channel. */
Used internally by the Set object to create a new channel.
Used internally by the Set object to create a new channel .
static channel_s *fio_channel_copy(channel_s *src) {
  channel_s *dest = malloc(sizeof(*dest) + src->name_len + 1);
  FIO_ASSERT_ALLOC(dest);
  dest->name_len = src->name_len;
  dest->match = src->match;
  dest->parent = src->parent;
  dest->name = (char *)(dest + 1);
  if (src->name_len)
    memcpy(dest->name, src->name, src->name_len);
  dest->name[src->name_len] = 0;
  dest->subscriptions = (fio_ls_embd_s)FIO_LS_INIT(dest->subscriptions);
  dest->ref = 1;
  dest->lock = FIO_LOCK_INIT;
  return dest;
}
static channel_s * fio_channel_copy ( channel_s * src ) { channel_s * dest = malloc ( sizeof ( * dest ) + src -> name_len + 1 ) ; FIO_ASSERT_ALLOC ( dest ) ; dest -> name_len = src -> name_len ; dest -> match = src -> match ; dest -> parent = src -> parent ; dest -> name = ( char * ) ( dest + 1 ) ; if ( src -> name_len ) memcpy ( dest -> name , src -> name , src -> name_len ) ; dest -> name [ src -> name_len ] = 0 ; dest -> subscriptions = ( fio_ls_embd_s ) FIO_LS_INIT ( dest -> subscriptions ) ; dest -> ref = 1 ; dest -> lock = FIO_LOCK_INIT ; return dest ; }
Used internally by the Set object to create a new channel.
Used internally by the Set object to create a new channel .