コード例 #1
0
ファイル: menus.c プロジェクト: amitesh-singh/Enlightenment
static void
MenuDestroy(Menu * m)
{
   if (!m)
      return;

   if (!ecore_list_goto(menu_list, m))
      return;

   MenuHide(m);
   MenuEmpty(m, 1);

   if (m->ref_count)
      return;

   ecore_list_node_remove(menu_list, m);

   if (m->win)
      EDestroyWindow(m->win);

   Efree(m->name);
   Efree(m->alias);
   Efree(m->title);
   Efree(m->data);

   Efree(m);
}
コード例 #2
0
ファイル: snaps.c プロジェクト: burzumishi/e16
static void
_SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
{
   EWin              **gwins;
   Group              *const *groups;
   int                 i, j, num, num_groups;

   if (!ewin)
      return;

   if (!ewin->groups)
     {
	Efree(sn->groups);
	sn->groups = NULL;
	sn->num_groups = 0;
	return;
     }

   gwins =
      ListWinGroupMembersForEwin(ewin, GROUP_ACTION_ANY, Mode.nogroup, &num);
   for (i = 0; i < num; i++)
     {
	if (onoff)
	  {
	     groups = EwinGetGroups(gwins[i], &num_groups);
	     if (!groups)
		continue;

	     sn = gwins[i]->snap;
	     if (!sn)
		sn = _SnapEwinGet(gwins[i], SNAP_MATCH_DEFAULT);
	     if (!sn)
		continue;

	     sn->num_groups = num_groups;
	     Efree(sn->groups);
	     sn->groups = EMALLOC(int, num_groups);

	     for (j = 0; j < num_groups; j++)
	       {
		  sn->groups[j] = groups[j]->index;
		  groups[j]->save = 1;
	       }
	  }
	else
	  {
	     if (ewin->snap)
	       {
		  sn = gwins[i]->snap;
		  if (sn)
		    {
		       Efree(sn->groups);
		       sn->groups = NULL;
		       sn->num_groups = 0;
		    }
	       }
	  }
     }
コード例 #3
0
void FreeNormProtos() {
  if (NormProtos != NULL) {
    for (int i = 0; i <= MAX_CLASS_ID; i++)
      FreeProtoList(&NormProtos->Protos[i]);
    Efree(NormProtos->ParamDesc);
    Efree(NormProtos);
    NormProtos = NULL;
  }
}
コード例 #4
0
ファイル: comms.c プロジェクト: Limsik/e17
void
ClientDestroy(Client * c)
{
   if (!c)
      return;

   Efree(c->msg);
   Efree(c);
}
コード例 #5
0
ファイル: normmatch.cpp プロジェクト: MaTriXy/tess-two
void Classify::FreeNormProtos() {
  if (NormProtos != NULL) {
    for (int i = 0; i < NormProtos->NumProtos; i++)
      FreeProtoList(&NormProtos->Protos[i]);
    Efree(NormProtos->Protos);
    Efree(NormProtos->ParamDesc);
    Efree(NormProtos);
    NormProtos = NULL;
  }
}
コード例 #6
0
ファイル: x.c プロジェクト: Limsik/e17
static void
EXidDestroy(Win win)
{
#if DEBUG_XWIN
   Eprintf("EXidDestroy: %p %#lx\n", win, win->xwin);
#endif
   if (win->rects)
      XFree(win->rects);
   Efree(win->cbl.lst);
   Efree(win);
}
コード例 #7
0
static void
RemoveEwinFromGroup(EWin * ewin, Group * g)
{
   int                 i, j, k, i2;

   if (!ewin || !g)
      return;

   for (k = 0; k < ewin->num_groups; k++)
     {
	/* is the window actually part of the given group */
	if (ewin->groups[k] != g)
	   continue;

	for (i = 0; i < g->num_members; i++)
	  {
	     if (g->members[i] != ewin)
		continue;

	     /* remove it from the group */
	     for (j = i; j < g->num_members - 1; j++)
		g->members[j] = g->members[j + 1];
	     g->num_members--;
	     if (g->num_members > 0)
		g->members = EREALLOC(EWin *, g->members, g->num_members);
	     else if (g->save)
	       {
		  Efree(g->members);
		  g->members = NULL;
	       }
	     else
	       {
		  GroupDestroy(g);
	       }

	     /* and remove the group from the groups that the window is in */
	     for (i2 = k; i2 < ewin->num_groups - 1; i2++)
		ewin->groups[i2] = ewin->groups[i2 + 1];
	     ewin->num_groups--;
	     if (ewin->num_groups <= 0)
	       {
		  Efree(ewin->groups);
		  ewin->groups = NULL;
		  ewin->num_groups = 0;
	       }
	     else
		ewin->groups =
		   EREALLOC(Group *, ewin->groups, ewin->num_groups);

	     GroupsSave();
	     return;
	  }
     }
コード例 #8
0
ファイル: iclass.c プロジェクト: Limsik/e17
static void
ImagestateRealize(ImageState * is)
{
   if (!is)
      return;
   if (is->im)			/* Image is already loaded */
      return;

   if (!is->real_file)
     {
	if (!is->im_file)
	   return;		/* No file - quit */
	/* not loaded, load and setup */
	is->real_file = ThemeFileFind(is->im_file, FILE_TYPE_IMAGE);
     }
   if (is->real_file)
     {
	is->im = EImageLoad(is->real_file);
	if (is->im && is->rotate)
	   EImageOrientate(is->im, is->rotate);
     }
   if (!is->im)
     {
#define S(s) ((s) ? (s) : "(null)")
	Eprintf
	   ("ImagestateRealize: Hmmm... is->im is NULL (im_file=%s real_file=%s)\n",
	    S(is->im_file), S(is->real_file));
	Efree(is->real_file);
	is->real_file = NULL;
	return;
     }

   Efree(is->im_file);		/* We no longer need the file */
   is->im_file = NULL;

   EImageCheckAlpha(is->im);

   if (is->border)
      EImageSetBorder(is->im, is->border);

#if 0				/* To be implemented? */
   if (is->colmod)
     {
	Imlib_set_image_red_curve(pImlib_Context, is->im, is->colmod->red.map);
	Imlib_set_image_green_curve(pImlib_Context, is->im,
				    is->colmod->green.map);
	Imlib_set_image_blue_curve(pImlib_Context, is->im,
				   is->colmod->blue.map);
     }
#endif
}
コード例 #9
0
static void
GroupDestroy(Group * g)
{
   if (!g)
      return;

   Dprintf("grp=%p gid=%d\n", g, g->index);
   ecore_list_node_remove(group_list, g);

   if (g == Mode_groups.current)
      Mode_groups.current = NULL;
   Efree(g->members);

   Efree(g);
}
コード例 #10
0
/*-------------------------------------------------------------------------*/
void free_adapted_class(ADAPT_CLASS adapt_class) { 
  int i;

  for (i = 0; i < MAX_NUM_CONFIGS; i++) {
    if (ConfigIsPermanent (adapt_class, i)
      && PermConfigFor (adapt_class, i) != NULL)
      Efree (PermConfigFor (adapt_class, i));
    else if (!ConfigIsPermanent (adapt_class, i)
      && TempConfigFor (adapt_class, i) != NULL)
      FreeTempConfig (TempConfigFor (adapt_class, i));
  }
  FreeBitVector (adapt_class->PermProtos);
  FreeBitVector (adapt_class->PermConfigs);
  destroy_nodes (adapt_class->TempProtos, FreeTempProto);
  Efree(adapt_class); 
}
コード例 #11
0
ファイル: main.c プロジェクト: burzumishi/e16
static void
EConfNameSet(const char *name)
{
    Efree(Mode.conf.name);
    Mode.conf.name = Estrdup(name);
    Esetenv("ECONFNAME", Mode.conf.name);
}
コード例 #12
0
ファイル: x.c プロジェクト: Limsik/e17
void
EventCallbackUnregister(Win win, EventCallbackFunc * func, void *prm)
{
   EventCallbackList  *ecl;
   EventCallbackItem  *eci;
   int                 i;

   if (!win)
      return;
#if 0
   Eprintf("EventCallbackUnregister: %p %#lx: func=%p prm=%p\n", win, win->xwin,
	   func, prm);
#endif

   ecl = &win->cbl;
   eci = ecl->lst;
   for (i = 0; i < ecl->num; i++, eci++)
      if (eci->func == func && eci->prm == prm)
	{
	   ecl->num--;
	   if (ecl->num)
	     {
		for (; i < ecl->num; i++, eci++)
		   *eci = *(eci + 1);
		win->cbl.lst =
		   EREALLOC(EventCallbackItem, win->cbl.lst, ecl->num);
	     }
	   else
	     {
		Efree(win->cbl.lst);
		win->cbl.lst = NULL;
	     }
	   return;
	}
}
コード例 #13
0
ファイル: clusttool.cpp プロジェクト: 0xkasun/tesseract
/**
 * This routine reads N floats from the specified text file
 * and places them into Buffer.  If Buffer is NULL, a buffer
 * is created and passed back to the caller.  If EOF is
 * encountered before any floats can be read, NULL is
 * returned.
 * @param File open text file to read floats from
 * @param N number of floats to read
 * @param Buffer pointer to buffer to place floats into
 * @return Pointer to buffer holding floats or NULL if EOF
 * @note Globals: None
 * @note Exceptions: ILLEGALFLOAT
 * @note History: 6/6/89, DSJ, Created.
 */
FLOAT32* ReadNFloats(FILE * File, uinT16 N, FLOAT32 Buffer[]) {
  bool needs_free = false;
  int i;
  int NumFloatsRead;

  if (Buffer == NULL) {
    Buffer = reinterpret_cast<FLOAT32*>(Emalloc(N * sizeof(FLOAT32)));
    needs_free = true;
  }

  for (i = 0; i < N; i++) {
    NumFloatsRead = tfscanf(File, "%f", &(Buffer[i]));
    if (NumFloatsRead != 1) {
      if ((NumFloatsRead == EOF) && (i == 0)) {
        if (needs_free) {
            Efree(Buffer);
        }
        return NULL;
      } else {
        DoError(ILLEGALFLOAT, "Illegal float specification");
      }
    }
  }
  return Buffer;
}
コード例 #14
0
ファイル: iclass.c プロジェクト: Limsik/e17
EImage             *
ThemeImageLoad(const char *file)
{
   EImage             *im;
   char               *f;

   if (!file)
      return NULL;

   if (file[0] == '/')
     {
	im = EImageLoad(file);
	return im;
     }

   f = ThemeFileFind(file, FILE_TYPE_IMAGE);
   if (f)
     {
	im = EImageLoad(f);
	Efree(f);
	return im;
     }

   return NULL;
}
コード例 #15
0
ファイル: iclass.c プロジェクト: Limsik/e17
static void
ImagestateDestroy(ImageState * is)
{
   if (!is)
      return;

   Efree(is->im_file);
   Efree(is->real_file);

   if (is->im)
      EImageFree(is->im);

   Efree(is->border);

   Efree(is);
}
コード例 #16
0
ファイル: warp.c プロジェクト: Limsik/e17
static void
WarpFocusWinDestroy(WarpFocusWin * fw)
{
   EventCallbackUnregister(EoGetWin(fw), WarpFocusHandleEvent, NULL);
   EoFini(fw);
   Efree(fw);
}
コード例 #17
0
ファイル: cursors.c プロジェクト: burzumishi/e16
static ECursor     *
ECursorRealize(ECursor * ec)
{
   Pixmap              pmap, mask;
   int                 xh, yh;
   unsigned int        w, h, ww, hh;
   char               *img, msk[FILEPATH_LEN_MAX];

   if (ec->file)
     {
	img = ThemeFileFind(ec->file, FILE_TYPE_CURSOR);
	_EFREE(ec->file);	/* Ok or not - we never need file again */
	if (!img)
	   goto done;

	Esnprintf(msk, sizeof(msk), "%s.mask", img);
	pmap = 0;
	mask = 0;
	xh = 0;
	yh = 0;
	XReadBitmapFile(disp, WinGetXwin(VROOT), msk, &w, &h, &mask, &xh, &yh);
	XReadBitmapFile(disp, WinGetXwin(VROOT), img, &w, &h, &pmap, &xh, &yh);
	XQueryBestCursor(disp, WinGetXwin(VROOT), w, h, &ww, &hh);
	if ((w <= ww) && (h <= hh) && (pmap))
	  {
	     if (xh < 0 || xh >= (int)w)
		xh = (int)w / 2;
	     if (yh < 0 || yh >= (int)h)
		yh = (int)h / 2;
	     ec->cursor =
		ECreatePixmapCursor(pmap, mask, w, h, xh, yh, ec->fg, ec->bg);
	  }

	if (ec->cursor == NoXID)
	  {
	     Eprintf("*** Failed to create cursor \"%s\" from %s,%s\n",
		     ec->name, img, msk);
	  }

	if (pmap)
	   EFreePixmap(pmap);
	if (mask)
	   EFreePixmap(mask);
	Efree(img);
     }
   else
     {
	ec->cursor = (ec->native_id == 999) ?
	   None : XCreateFontCursor(disp, ec->native_id);
     }

 done:
   if (ec->cursor == NoXID)
     {
	ECursorDestroy(ec);
	ec = NULL;
     }

   return ec;
}
コード例 #18
0
ファイル: magwin.c プロジェクト: gzorin/e17
static void
MagwinDestroy(MagWindow * mw)
{
#if USE_TIMER
   TIMER_DEL(mw->timer);
#endif
   Efree(mw);
}
コード例 #19
0
static void
IpcPrintDone(void)
{
   Efree(ipc_bufptr);
   ipc_bufptr = NULL;
   ipc_bufsiz = 0;
   ipc_active = 0;
}
コード例 #20
0
ファイル: featdefs.cpp プロジェクト: ErfanHasmin/scope-ocr
/**
 * Release the memory consumed by the specified character
 * description and all of the features in that description.
 *
 * @param CharDesc character description to be deallocated
 *
 * Globals: 
 * - none
 *
 * @note Exceptions: none
 * @note History: Wed May 23 13:52:19 1990, DSJ, Created.
 */
void FreeCharDescription(CHAR_DESC CharDesc) {
  int i;

  if (CharDesc) {
    for (i = 0; i < CharDesc->NumFeatureSets; i++)
      FreeFeatureSet (CharDesc->FeatureSets[i]);
    Efree(CharDesc);
  }
}                                /* FreeCharDescription */
コード例 #21
0
ファイル: snaps.c プロジェクト: burzumishi/e16
static void
_SnapUpdateEwinCmd(Snapshot * sn, const EWin * ewin)
{
   if (ewin->icccm.wm_machine &&
       strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
      return;

   Efree(sn->cmd);
   sn->cmd = Estrdup(ewin->icccm.wm_command);
}
コード例 #22
0
ファイル: cursors.c プロジェクト: burzumishi/e16
static void
ECursorDestroy(ECursor * ec)
{
   if (!ec)
      return;

   if (ec->ref_count > 0)
     {
	DialogOK("ECursor Error!", _("%u references remain"), ec->ref_count);
	return;
     }

   LIST_REMOVE(ECursor, &cursor_list, ec);

   Efree(ec->name);
   Efree(ec->file);

   Efree(ec);
}
コード例 #23
0
ファイル: adaptive.cpp プロジェクト: ErfanHasmin/scope-ocr
/*----------------------------------------------------------------------------*/
void free_adapted_templates(ADAPT_TEMPLATES templates) {

  if (templates != NULL) {
    int i;
    for (i = 0; i < (templates->Templates)->NumClasses; i++)
      free_adapted_class (templates->Class[i]);
    free_int_templates (templates->Templates);
    Efree(templates);
  }
}
コード例 #24
0
ファイル: file.c プロジェクト: burzumishi/e16
int
path_canexec(const char *file)
{
   char               *s;

   s = path_test(file, EFILE_REG | EPERM_X);
   if (!s)
      return 0;
   Efree(s);
   return 1;
}
コード例 #25
0
ファイル: warp.c プロジェクト: Limsik/e17
static void
WarpFocusHide(void)
{
   WarpFocusWin       *fw = warpFocusWindow;

   if (fw && EoIsShown(fw))
      WarpFocusWinHide(fw);

   Efree(warplist);
   warplist = NULL;
   warplist_num = 0;
}
コード例 #26
0
ファイル: symbol.c プロジェクト: nonakap/xnscripchan
void
symbol_destroy(object_t *obj)
{
    symbol_t *p, *next;

    _ASSERT(obj != NULL);

    for (p = (symbol_t *)obj; p != NULL; p = next) {
        next = p->next;
        Efree(p);
    }
}
コード例 #27
0
ファイル: draw.c プロジェクト: burzumishi/e16
void
DrawEwinShapeEnd(EWin * ewin)
{
    ShapeData          *psd = (ShapeData *) ewin->shape_data;

    if (!psd)
        return;
    if (psd->shwin)
        ShapewinDestroy(psd->shwin);
    Efree(psd);
    ewin->shape_data = NULL;
}
コード例 #28
0
ファイル: archive.c プロジェクト: nonakap/xnscripchan
void
archive_delete(object_t *obj)
{
	archive_t *arc;
	int i;

	_ASSERT(obj != NULL);
	_ASSERT(obj->type == OBJECT_ARCHIVE);

	if (--obj->ref_count > 0)
		return;

	arc = (archive_t *)obj;

	if (arc->fd != NULL) {
		for (i = 0; i < arc->fd_num; i++) {
			if (arc->fd[i] != NULL) {
				fclose(arc->fd[i]->fp);
				arc->fd[i] = NULL;
			}
		}
		Efree(arc->fd);
		arc->fd = NULL;
	}

	if (arc->table_count != NULL) {
		Efree(arc->table_count);
		arc->table_count = NULL;
	}
	if (arc->table != NULL) {
		for (i = 0; i < arc->hash_num; i++) {
			if (arc->table[i] != NULL) {
				Efree(arc->table[i]);
				arc->table[i] = NULL;
			}
		}
		Efree(arc->table);
		arc->table = NULL;
	}
}
コード例 #29
0
ファイル: iconify.c プロジェクト: Limsik/e17
static Container   *
SelectIconboxForEwin(EWin * ewin)
{
   /* find the appropriate iconbox from all available ones for this app */
   /* if it is to be iconified, or if it is alreayd return which iconbox */
   /* it's in */
   Container          *ct, *ib_sel = NULL;

   if (!ewin)
      return NULL;

   if (ewin->state.iconified)
     {
	/* find the iconbox this window got iconifed into */
	ib_sel = ContainersIterate(IconboxFindEwin, IB_TYPE_ICONBOX, ewin);
     }
   else
     {
	/* pick the closest iconbox physically on screen to put it in */
	int                 min_dist;
	int                 dx, dy, dist;
	int                 i, num;
	Container         **lst;

	lst = ContainersGetList(&num);
	min_dist = 0x7fffffff;
	for (i = 0; i < num; i++)
	  {
	     ct = lst[i];
	     if (!ct->ewin || ct->type != IB_TYPE_ICONBOX)
		continue;

	     dx = (EoGetX(ct->ewin) + (EoGetW(ct->ewin) / 2)) -
		(EoGetX(ewin) + (EoGetW(ewin) / 2));
	     dy = (EoGetY(ct->ewin) + (EoGetH(ct->ewin) / 2)) -
		(EoGetY(ewin) + (EoGetH(ewin) / 2));
	     dist = (dx * dx) + (dy * dy);
	     if ((!EoIsSticky(ct->ewin)) &&
		 (EoGetDesk(ct->ewin) != EoGetDesk(ewin)))
		dist += (WinGetW(VROOT) * WinGetW(VROOT)) +
		   (WinGetH(VROOT) * WinGetH(VROOT));
	     if (dist < min_dist)
	       {
		  min_dist = dist;
		  ib_sel = ct;
	       }
	  }
	Efree(lst);
     }

   return ib_sel;
}
コード例 #30
0
ファイル: snaps.c プロジェクト: burzumishi/e16
static void
_SnapDestroy(Snapshot * sn)
{
   LIST_REMOVE(Snapshot, &ss_list, sn);

   if (sn->used)
      sn->used->snap = NULL;

   Efree(sn->name);
   Efree(sn->win_title);
   Efree(sn->win_name);
   Efree(sn->win_class);
   Efree(sn->win_role);
   Efree(sn->border_name);
   Efree(sn->cmd);
   Efree(sn->groups);

   Efree(sn);
}