Beispiel #1
0
scm_sizet ragnarok_free_epoll_event_set(SCM ee_set)
#define FUNC_NAME "free-epoll-event-set"
{
  scm_rag_epoll_event_set *ees = (scm_rag_epoll_event_set*)SCM_SMOB_DATA(ee_set);

  // close epfd
  close(ees->epfd);

  // NOTE: The second para 'size' is always ignored in Guile 2.x.
  scm_gc_free(ees->ee_set ,0 ,"rag-epoll-event-inner-set");
  scm_gc_free(ee_set ,0 ,"rag-epoll-event-set");

  return 0;
}
Beispiel #2
0
static size_t free_board (SCM board_smob) {
	struct board *board = (struct board *) SCM_SMOB_DATA(board_smob);

	scm_gc_free(board, sizeof(struct board), "board");

	return 0;
}
Beispiel #3
0
size_t free_llvm_function(SCM scm_self)
{
  struct llvm_function_t *self = get_llvm_function_no_check(scm_self);
  llvm_function_destroy(scm_self);
  scm_gc_free(self, sizeof(struct llvm_function_t), "function");
  return 0;
}
Beispiel #4
0
size_t free_tensor(SCM scm_self)
{
  struct tf_tensor_t *self = get_tf_tensor_no_check(scm_self);
  TF_DeleteTensor(self->tensor);
  scm_gc_free(self, sizeof(struct tf_tensor_t), "tensor");
  return 0;
}
Beispiel #5
0
size_t free_graph(SCM scm_self)
{
  struct tf_graph_t *self = get_tf_graph_no_check(scm_self);
  TF_DeleteGraph(self->graph);
  scm_gc_free(self, sizeof(struct tf_graph_t), "graph");
  return 0;
}
Beispiel #6
0
size_t free_session(SCM scm_self)
{
  struct tf_session_t *self = get_tf_session_no_check(scm_self);
  TF_DeleteSession(self->session, status());
  scm_gc_free(self, sizeof(struct tf_session_t), "session");
  return 0;
}
Beispiel #7
0
size_t
gc_free_termios (SCM x)
{
  struct termios *gp;

  scm_assert_smob_type (termios_tag, x);

  gp = (struct termios *) SCM_SMOB_DATA (x);

  assert (gp != NULL);
  if (0)
    {
      fprintf (stderr, "Freeing termios at %p\n", gp);
      fprintf (stderr, "Flags: I %u O %u C %u L %u\n", gp->c_iflag,
               gp->c_oflag, gp->c_cflag, gp->c_lflag);
      fprintf (stderr, "Speed: O %u I %u\n", cfgetospeed(gp),
               cfgetispeed(gp));
      fflush (stderr);
      sleep (1);
    }

  scm_gc_free (gp, sizeof (struct termios), "termios");

  SCM_SET_SMOB_DATA (x, NULL);

  return 0;
}
Beispiel #8
0
size_t free_llvm_module(SCM scm_self)
{
  struct llvm_module_t *self = get_llvm_no_check(scm_self);
  llvm_module_destroy(scm_self);
  scm_gc_free(self, sizeof(struct llvm_module_t), "llvm");
  return 0;
}
Beispiel #9
0
SCM scm_gunzip_buf(SCM scm_buf, SCM scm_outlen){
  //this should typecheck buf for us
  size_t buflen = scm_c_bytevector_length(scm_buf);
  uint8_t *buf = (uint8_t*)SCM_BYTEVECTOR_CONTENTS(scm_buf);
  size_t outlen = scm_to_size_t(scm_outlen);
  uint8_t *out = scm_gc_malloc_pointerless(outlen, SCM_GC_BYTEVECTOR);

  z_stream stream = {.next_in = buf, .avail_in = buflen,
                     .next_out = out, .avail_out = outlen,
                     .zalloc = NULL, .zfree = NULL, .opaque = NULL};
  //15 | 16 means use 15 bits for the decompression window, and only accept
  //gzip compressed buffers
  inflateInit2(&stream, 15 | 16);
  int status = inflate(&stream, Z_FINISH);
  if(status != Z_STREAM_END){ //the output buffer was too small
    //Do something useful here, for now this just makes sure that
    //we don't cause any errors
    fprintf(stderr, "Return value was %d, expecting %d\n",
            status, Z_FINISH);
    scm_gc_free(out, outlen, SCM_GC_BYTEVECTOR);
    SCM ret = scm_from_utf8_string(stream.msg);
    inflateEnd(&stream);
    
    return ret;
  }
  //I don't know what the tag bits for a bytevector are so I need to
  //make an empty one.
  SCM bv = scm_c_make_bytevector(0);
  SCM_SET_CELL_WORD_1(bv, stream.total_out);
  SCM_SET_CELL_WORD_2(bv, out);
  inflateEnd(&stream);
  return bv;
}
Beispiel #10
0
size_t free_ffmpeg(SCM scm_self)
{
  struct ffmpeg_t *self = get_self_no_check(scm_self);
  ffmpeg_destroy(scm_self);
  scm_gc_free(self, sizeof(struct ffmpeg_t), "ffmpeg");
  return 0;
}
Beispiel #11
0
static size_t
free_x (SCM x)
{
  x_t *c_x;
  c_x = (x_t *) SCM_SMOB_DATA (x);
  scm_gc_free (c_x, sizeof (x_t), "x");
  c_x = NULL;
  return 0;
}
Beispiel #12
0
static size_t
free_game (SCM game_smob)
{
    Game *game = (Game *) SCM_SMOB_DATA (game_smob);

    scm_gc_free (game, sizeof (Game), "game");

    return 0;
}
Beispiel #13
0
size_t Display::free_image(SCM image) {
  struct image *img = (struct image *) SCM_SMOB_DATA(image);
#ifdef WITH_SDL
	std::cout << "Free !\n";
	SDL_FreeSurface(img->surface);
	/*scm_gc_free(img->surface, sizeof(SDL_Surface), "SDL surface");*/
	scm_gc_free(img, sizeof(struct image), "image");
#endif
	return 0;
}
Beispiel #14
0
static size_t
free_sample (SCM sample_smob)
{
    Sample *sample = (Sample *) SCM_SMOB_DATA (sample_smob);

    al_destroy_sample (sample->sample);

    scm_gc_free (sample, sizeof (Sample), "sample");

    return 0;
}
Beispiel #15
0
static int
#else
static void
#endif
ptob_close (SCM channel)
{
  struct channel_data *ch = _scm_to_channel_data (channel);

#if USING_GUILE_BEFORE_2_2
  scm_port *pt = SCM_PTAB_ENTRY (channel);

  ptob_flush (channel);
#endif

  if (ch && ssh_channel_is_open (ch->ssh_channel))
    {
      _gssh_log_debug ("ptob_close", "closing and freeing the channel...",
                       channel);
      ssh_channel_close (ch->ssh_channel);
      ssh_channel_free (ch->ssh_channel);
      _gssh_log_debug1 ("ptob_close", "closing and freeing the channel... done");
    }
  else
    {
      _gssh_log_debug1 ("ptob_close", "the channel is already freeed.");
    }

  SCM_SETSTREAM (channel, NULL);

#if USING_GUILE_BEFORE_2_2
  scm_gc_free (pt->write_buf, pt->write_buf_size, "port write buffer");
  scm_gc_free (pt->read_buf,  pt->read_buf_size, "port read buffer");

  return 0;
#endif
}
static int
gdbscm_memory_port_close (SCM port)
{
  scm_t_port *pt = SCM_PTAB_ENTRY (port);
  ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (port);

  gdbscm_memory_port_flush (port);

  if (pt->read_buf == pt->putback_buf)
    pt->read_buf = pt->saved_read_buf;
  if (pt->read_buf != &pt->shortbuf)
    xfree (pt->read_buf);
  if (pt->write_buf != &pt->shortbuf)
    xfree (pt->write_buf);
  scm_gc_free (iomem, sizeof (*iomem), "memory port");

  return 0;
}
Beispiel #17
0
size_t free_description(SCM scm_self)
{
  struct tf_description_t *self = get_tf_description_no_check(scm_self);
  scm_gc_free(self, sizeof(struct tf_description_t), "description");
  return 0;
}
Beispiel #18
0
size_t free_output(SCM scm_self)
{
  struct tf_output_t *self = get_tf_output_no_check(scm_self);
  scm_gc_free(self, sizeof(struct tf_output_t), "output");
  return 0;
}
Beispiel #19
0
void
gshmup_destroy_player (GshmupPlayer *player)
{
    g_free (player->entity.name);
    scm_gc_free (player, sizeof (GshmupPlayer), "player");
}
Beispiel #20
0
static size_t free_cell (SCM cell_smob) {
	struct cell *cell = (struct cell *) SCM_SMOB_DATA(cell_smob);

	scm_gc_free(cell, sizeof(struct cell), "cell");
	return 0;
}