Пример #1
0
void fluidMessengerOnFree(void *o)
{
	fluidMessenger *fm = (fluidMessenger*)o;
	x_free(fm->s);
	x_free(fm->f);
	x_free(fm->m);
}
Пример #2
0
void
MibDeRegister( mib_object_t *object )
{
    MibObjectDelete(object);
    x_free(object->Id);
    x_free(object);
}
Пример #3
0
mib_object_t *
MibRegister( ul32 *Id, u16 IdLen, mib_callback_t Rqs, u16 Type, u16 Support, void *Param )
{
    mib_object_t *object;

    object = (mib_object_t *)x_malloc(sizeof(mib_object_t));
    if (object == 0) {
        x_dbg("XSNMP, MibRegister: object is 0\n", TRUE);
        return 0;
    }
    if( !IdLen )
        x_dbg("XSNMP, MibRegister: Idlen == 0\n", TRUE);
    object->Id = (ul32 *)x_malloc(IdLen * sizeof(l32));
    if (object->Id == 0) {
        x_dbg("XSNMP, MibRegister: object->ID is 0\n", TRUE);
        return 0;
    }
    x_memcpy(object->Id, Id, IdLen * sizeof(l32));
    object->IdLen	= IdLen;
    object->Rqs		= Rqs;
    object->Type	= Type;
    object->Support	= Support;
    object->Param	= Param;

    if (!MibObjectInsert(object)) {
        x_free(object->Id);
        x_free(object);
        x_dbg("XSNMP, MibRegister: MibObjectInsert fail\n", TRUE);
        return 0;
    }

    return object;
}
Пример #4
0
bool
MibRemove( snmp_object_t *Obj, mib_local_t **local, u16 IdLen, u16 IdSize )
{
    mib_local_t * Junk;
    mib_local_t * Local = *local;

    if(Obj->IdLen != (u32)(IdLen + IdSize) || Obj->Id[IdLen] < 1)
        if(Local == NULL)
            return FALSE;
    if(Obj->IdLen != (u32)(IdLen + IdSize))
        return FALSE;
    if((u32)Local->Index == Obj->Id[IdLen]) {
        Junk = Local->Next;
        x_free(Local);
        *local = Junk;
        return TRUE;
    }
    while(Local->Next != NULL && (u32)Local->Next->Index < Obj->Id[IdLen])
        Local = Local->Next;
    if((u32)Local->Next->Index == Obj->Id[IdLen]) {
        Junk = Local->Next->Next;
        x_free(Local->Next);
        Local->Next = Junk;
        return TRUE;
    }
    return FALSE;
}
Пример #5
0
void x_destroy_pool(x_pool_t *pool)
{
  x_pool_t          *p, *n;
  x_pool_large_t    *l;
  x_pool_cleanup_t  *c;

  for (c = pool->cleanup; c; c = c->next) {
    if (c->handler) {
      c->handler(c->data);
    }
  }

  for (l = pool->large; l; l = l->next) {
    if (l->alloc) {
      x_free(l->alloc);
    }
  }

  for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
    x_free(p);
    
    if (n == NULL) {
      break;
    }
  }
}
Пример #6
0
void view_struct_free (view_struct *vs) {
	if (!vs)
		return;
	if (vs->buf8)
		x_free(vs->buf8);
	x_free(vs);
}
Пример #7
0
void draw_buf_free (draw_buf *dr_buf) {
    if (dr_buf->data)
        x_free(dr_buf->data);
    if (dr_buf->tmp)
        x_free(dr_buf->tmp);
    if (dr_buf->tail)
        x_free(dr_buf->tail);
    x_free(dr_buf);
}
Пример #8
0
void
release_client(struct client *cl)
{
    if (cl->ct_username) x_free(cl->ct_username);
    if (cl->ct_machname) x_free(cl->ct_machname);
    if (cl->ct_ipaddr) x_free(cl->ct_ipaddr);
    if (cl->ct_fusername) x_free(cl->ct_fusername);
    if (cl->ct_passwd) x_free(cl->ct_passwd);
}
Пример #9
0
//Frees the coherence engine
void mpCFree(void *in_o)
{
	mpCoherence *o = (mpCoherence*)in_o;
	if (o->r_tasks)		free(o->r_tasks);
	if (o->r_q)			x_free(o->r_q);
	
#ifdef SEQUENTIAL
	if (o->r_stack)		x_free(o->r_stack);
#endif
	
	pthread_mutex_destroy(&o->m_mutex);
}
Пример #10
0
void pen_free(pen_struct *ps) {
    if (!ps)
        return;
    if (ps->map)
        map_free(ps->map);
    x_free(ps);
}
Пример #11
0
void gl_preview_free (gl_preview_struct *gl_preview) {
	gint i;
//	static GtkWidget *w;
// printf("GL_PREVIEW_FREE - 1; GL_AREA: %x = %d\n", gl_preview->gl_area,gl_preview->gl_area);
	if (gl_preview)
		if (gl_preview->cameras) {
			for (i=0; i<NBCAMERAS; i++) {
				if (gl_preview->cameras[i])
					x_free(gl_preview->cameras[i]);
			}
		if (gl_preview->hf)
			x_free(gl_preview->hf);
		x_free (gl_preview);
	}
// printf("GL_PREVIEW_FREE - 2\n");
}
Пример #12
0
void *netServerConnection(void *eData)
{
	netServer *sData = (netServer*)eData;
	
	mpMutexLock(sData->r_mutex);
	
	if (sData->m_delegate.onConnect != NULL)
		sData->m_delegate.onConnect(sData->m_delegate.obj, sData);
	
	netClient *cur = sData->m_client;
	sData->m_client = NULL;
	
	mpMutexUnlock(sData->r_mutex);
	
	x_try
		sData->m_userFunction(sData->m_userData, sData, cur);
	x_catch(e)
		errorListAdd(e);
	x_finally
	
	x_free(cur);
	
	mpMutexLock(sData->r_mutex);
	sData->m_runningThreads--;
	
	if (sData->m_delegate.onDisconnect != NULL)
		sData->m_delegate.onDisconnect(sData->m_delegate.obj, sData);
	
	mpMutexUnlock(sData->r_mutex);
	
	return NULL;
}
void btnTest_Click (HWND hwnd)
{
  FillParameters(hwnd, pParams);
  wchar_t *testResultMsg= mytest(hwnd, pParams);
  MessageBoxW(hwnd, testResultMsg, L"Test Result", MB_OK);
  x_free(testResultMsg);
}
Пример #14
0
void xTextFreeFont(xBitmapFont* font)
{
	if (font != NULL)
	{
		x_free(font);
	}
}
Пример #15
0
void fractal_polyline_free (fractal_line_struct *f) {
	if (f) {
		if (f->polyline)
			line_free(f->polyline);
		x_free(f);
	}
}
Пример #16
0
mib_local_t *
MibInsert( snmp_object_t *Obj, mib_local_t **local, u16 IdLen, u16 IdSize )
{
    mib_local_t * Junk;
    mib_local_t	* Local = *local;

    if(Obj->IdLen != (u32)(IdLen + IdSize) || Obj->Id[IdLen] < 1) {
        return NULL;
    }
    if((Junk = (mib_local_t *)x_malloc(sizeof(mib_local_t))) == NULL) {
        return NULL;
    }
    Junk->Index = Obj->Id[IdLen];

    if(Local == NULL || Local->Index > Junk->Index) {
        Junk->Next = Local;
        *local = Junk;
        return Junk;
    }
    while(Local->Next != NULL && Local->Next->Index <= Junk->Index)
        Local = Local->Next;
    if(Local->Index == Junk->Index) {
        x_free(Junk);
        return Local;
    }
    Junk->Next = Local->Next;
    Local->Next = Junk;

    return Junk;
}
Пример #17
0
void app_free(app_struct *app) {
	if (app->types)
 		types_wrapper_free(app->types);
//	At this point, documents (app->docs->doc_list) are supposed to be freed
	if (app->docs)
		doc_swap_free(app->docs);
	if (app)
		x_free(app);
}
Пример #18
0
void xpalloc_deinit(XPicoAllocator* self)
{
    X_ASSERT(self);
    if (self->ownmemory)
    {
        x_free(self->heap);
        self->heap = NULL;
        self->ownmemory = false;
    }
}
Пример #19
0
void
stun_pkt_free(stun_packet_t *pkt)
{
  stun_attr_t *attrs;
  int i;

  ENTER;

  for (attrs = pkt->attrs, i = 0; i < pkt->attrnum; i++)
    {
      if (attrs[i].data)
        x_free(attrs[i].data);
    }
  if (pkt->attrs)
    x_free(pkt->attrs);
  x_free(pkt);

  EXIT;
}
Пример #20
0
static void teardown(void)
{
        regex_teardown();

        g_queue_free_full(history, teardown_notification);
        g_queue_free_full(displayed, teardown_notification);
        g_queue_free_full(queue, teardown_notification);

        x_free();
}
Пример #21
0
void reset_seeds (fill_struct *f) {
	// Resets the filling seeds list to a NULL list
	GList *node;
//	printf("RESET_SEEDS; list length: %d\n",g_list_length(f->seeds_list));
	for (node = f->seeds_list; node; node = node->next) {
		x_free((seed_coord *) node->data);
	}
	g_list_free(f->seeds_list);
	f->seeds_list = NULL;
}
Пример #22
0
static void DestroyTask(void* a)
{
    DestroyArg* arg = a;

    if (arg->delay > 0)
        xfiber_delay(arg->delay);

    XFiberMutex* mutex = arg->mutex;
    x_free(arg);
    xfiber_mutex_destroy(mutex);
}
Пример #23
0
void errorFree(void *in_o)
{
	error *in_error = (error*)in_o;
	if (in_error)
	{
		if (in_error->m_next) x_free(in_error->m_next);
		
		if (in_error->m_string)
			free(in_error->m_string);
	}
}
Пример #24
0
int			delete_node(t_ant *root, t_ant *tmp,
				    t_pos *pos, t_ia *ia)
{
  t_ant			*save;

  save = tmp->next;
  tmp->prev->next = tmp->next;
  tmp->next->prev = tmp->prev;
  x_free(tmp);
  return (action_ant(root, save, pos, ia));
}
Пример #25
0
void map_free (map_struct *map) {
    if (!map)
        return;
    if (map->data) {
        x_free(map->data);
        map->data = NULL;
    }
    if (map->tmp) {
        x_free(map->tmp);
        map->tmp = NULL;
    }
    if (map->units) {
        x_free(map->units);
        map->units = NULL;
    }
    map->radius = 0;
    if (map->dr_buf) {
        draw_buf_free(map->dr_buf);
        map->dr_buf = NULL;
    }
}
Пример #26
0
void save_copy_as_callb(GtkWidget *wdg,gpointer data) {
//	Saves top document under a new name,
//	after copying it in a new window
//	Choose new file name
	//	Returns if cancelled
//	Create new doc_wrapper

//	Simple implementation (probably with overhead...):
//	Save under a new name, reopen the original document,
//	swap on the top the old renamed document

	app_struct *app;
	gchar *dname, *fname;
	doc_wrapper *doc;
	app = (app_struct *)data;
	if (!app->docs)
		return;
	if (!app->docs->current_doc)
		return;
	doc = app->docs->current_doc;

	if (doc->fname_tochoose) {
		my_msg(_("You'll be asked to save the document before cloning it."),INFO);
	}
	// Any modification should be saved, whatever happens
	commit_or_reset (app->stack);
	doc_save(app->docs->current_doc);
	
	if (app->file_on_cmdline)
		x_free(app->file_on_cmdline);
	app->file_on_cmdline = concat_dname_fname(doc->dir, doc->filename);

	app->docs->current_doc->fname_tochoose = TRUE;
	if (!doc_save(app->docs->current_doc)) {
		app->docs->current_doc->fname_tochoose = FALSE;
		return;
	}

	fname = doc->filename;	// new name
	dname = doc->dir;
	open_callb(NULL,data);  // Open the filename given by app->file_on_cmdline (old name)
//	Swap the file and dir names (some window focusing problems, otherwise)
	doc->filename = app->docs->current_doc->filename; // old name
	doc->dir = app->docs->current_doc->dir;
	app->docs->current_doc->filename = fname;
	app->docs->current_doc->dir = dname;
//	Old name for original doc
	gtk_window_set_title(GTK_WINDOW(doc->window), g_filename_to_utf8(app->file_on_cmdline,-1, NULL, NULL, NULL));
//	New name for newly opened doc
	gtk_window_set_title(GTK_WINDOW(app->docs->current_doc->window),
		 g_filename_to_utf8(concat_dname_fname(dname, fname), -1, NULL, NULL, NULL));
}
void getStrFieldData(HWND hwnd, SQLWCHAR **param, int idc)
{
  x_free(*param);
  *param= NULL;

  int len = Edit_GetTextLength(GetDlgItem(hwnd,idc));

  if (len>0)
  {
    *param= (SQLWCHAR *)myodbc_malloc((len + 1) * sizeof(SQLWCHAR), MYF(0));
    if (*param)
      Edit_GetText(GetDlgItem(hwnd,idc), *param, len+1);
  }
}
Пример #28
0
x_int_t x_pfree(x_pool_t *pool, void *p)
{
  x_pool_large_t *l;

  for (l = pool->large; l; l = l->next) {
    if (l = l->alloc) {
      x_free(l->alloc);
      l->alloc = NULL;
      return XC_OK;
    }
  }

  return XC_DECLINED;
}
Пример #29
0
void netServerFree(void *in_o)
{
	netServer *in_svr = (netServer*)in_o;
	mpMutex *mtx = in_svr->r_mutex;
	
	//Mark the server as dead (so that spawned threads can cut connections
	//as needed.
	while (AtomicCompareAndSwapInt(in_svr->m_isDead, 0, 1) != 1) {}
	
	
	mpMutexLock(mtx);
	if (in_svr->m_socket != -1)
		close(in_svr->m_socket);
	mpMutexUnlock(mtx);
	
	if (mtx != NULL)
	{
		pthread_t tmp = in_svr->m_serverThread;
		x_pthread_join(tmp);

		mpMutexLock(mtx);
		
		while (in_svr->m_runningThreads != 0)
		{
			mpMutexUnlock(mtx);
			
			mpMutexLock(mtx);
		}
		mpMutexUnlock(mtx);
	}
		
	memset(in_svr, 0, sizeof(netServer));
	
	if (mtx) x_free(mtx);
	x_free(in_svr);
}
Пример #30
0
void			apply_globing(char **cmdline)
{
  char			**wt;
  char			*buffer;
  int			i;

  if (!(wt = my_make_argv(*cmdline, 0)))
    return ;
  i = 0;
  while (wt[i])
    {
      buffer = NULL;
      if (!IS_INHIBITOR(*(wt[i])) && !get_globing(wt[i], &buffer))
	{
	  x_free(wt[i]);
	  wt[i] = buffer;
	}
      i += 1;
    }
  x_free(*cmdline);
  *cmdline = my_join(wt, " ");
  my_wt_free(wt);
  x_free(wt);
}