strdup wrapped... and err.. looking for a mem leak.. anyone got insure++ ?


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 22 years ago
parent 6347565356
commit 68f5a95f2e
  1. 2
      src/Makefile.am
  2. 13
      src/actions.c
  3. 5
      src/background.c
  4. 17
      src/border.c
  5. 10
      src/config.c
  6. 2
      src/desktops.c
  7. 10
      src/e.h
  8. 3
      src/icccm.c
  9. 36
      src/util.c
  10. 8
      src/util.h
  11. 28
      src/view.c
  12. 1
      src/view.h

@ -31,5 +31,5 @@ enlightenment_SOURCES = \
view.h view.c \
e.h
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc $(INTLLIBS)
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc -ldl $(INTLLIBS)

@ -6,6 +6,7 @@
#include "icccm.h"
#include "keys.h"
#include "view.h"
#include "util.h"
static Evas_List action_protos = NULL;
static Evas_List current_actions = NULL;
@ -191,12 +192,12 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
OBJ_INIT(aa, _e_action_free);
aa->name = strdup(a->name);
aa->action = strdup(a->action);
if (a->params) aa->params = strdup(a->params);
e_strdup(aa->name, a->name);
e_strdup(aa->action, a->action);
e_strdup(aa->params, a->params);
aa->event = a->event;
aa->button = a->button;
if (a->key) aa->key = strdup(a->key);
e_strdup(aa->key, a->key);
aa->modifiers = a->modifiers;
aa->action_proto = ap;
aa->object = o;
@ -396,7 +397,7 @@ e_action_add_proto(char *action,
OBJ_INIT(ap, NULL);
ap->action = strdup(action);
e_strdup(ap->action, action);
ap->func_start = func_start;
ap->func_stop = func_stop;
ap->func_go = func_go;
@ -435,7 +436,7 @@ e_action_add_timer(void *o, char *name)
at = NEW(E_Active_Action_Timer, 1);
at->object = o;
at->name = strdup(name);
e_strdup(at->name, name);
current_timers = evas_list_append(current_timers, at);
}

@ -1,4 +1,5 @@
#include "background.h"
#include "util.h"
void
e_background_free(E_Background *bg)
@ -56,7 +57,7 @@ e_background_load(char *file)
e_db_int_get(db, "/layers/count", &num);
bg = e_background_new();
bg->file = strdup(file);
e_strdup(bg->file, file);
for (i = 0; i < num; i++)
{
E_Background_Layer *bl;
@ -71,7 +72,7 @@ e_background_load(char *file)
sprintf(buf, "/layers/%i/color_class", i); bl->color_class = e_db_str_get(db, buf);
if (bl->inlined)
{
sprintf(buf, "%s:/layers/%i/image", file, i); bl->file = strdup(buf);
sprintf(buf, "%s:/layers/%i/image", file, i); e_strdup(bl->file, buf);
}
else
{

@ -1039,7 +1039,7 @@ e_border_apply_border(E_Border *b)
/* if it's not changed - abort and dont do anything */
if ((b->border_file) && (!strcmp(buf, b->border_file))) return;
IF_FREE(b->border_file);
b->border_file = strdup(buf);
e_strdup(b->border_file, buf);
e_border_set_bits(b, buf);
@ -1138,8 +1138,10 @@ e_border_adopt(Window win, int use_client_pos)
{
E_Border *b;
int bw;
static int bd_count = 0;
/* create the struct */
printf("new bd %i\n", bd_count++);
b = e_border_new();
/* set the right event on the client */
e_window_set_events(win,
@ -1368,7 +1370,7 @@ e_border_new(void)
font_dir);
b->win.b = evas_get_window(b->evas.b);
e_add_child(b->win.main, b->win.b);
b->obj.title.l = evas_add_text(b->evas.l, "borzoib", 8, "");
b->obj.title.r = evas_add_text(b->evas.r, "borzoib", 8, "");
b->obj.title.t = evas_add_text(b->evas.t, "borzoib", 8, "");
@ -1417,6 +1419,7 @@ e_border_new(void)
e_window_raise(b->win.t);
e_window_raise(b->win.b);
*/
evases = evas_list_append(evases, b->evas.l);
evases = evas_list_append(evases, b->evas.r);
evases = evas_list_append(evases, b->evas.t);
@ -1433,7 +1436,7 @@ e_border_new(void)
e_window_show(b->win.b);
e_border_attach_mouse_grabs(b);
borders = evas_list_prepend(borders, b);
return b;
@ -1462,6 +1465,11 @@ e_border_free(E_Border *b)
e_window_destroy(b->win.main);
borders = evas_list_remove(borders, b);
IF_FREE(b->client.title);
IF_FREE(b->client.name);
IF_FREE(b->client.class);
IF_FREE(b->border_file);
if (b->grabs)
{
for (l = b->grabs; l; l = l->next)
@ -1471,7 +1479,7 @@ e_border_free(E_Border *b)
evas_list_free(b->grabs);
}
free(b);
FREE(b);
}
void
@ -1663,7 +1671,6 @@ e_border_set_bits(E_Border *b, char *file)
b->bits.r = ebits_load(file);
b->bits.t = ebits_load(file);
b->bits.b = ebits_load(file);
b->bits.new = 1;
b->changed = 1;

@ -98,16 +98,6 @@ e_config_init(void)
if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/apps_menu.db", buf);
sprintf(buf, "%sappearance/borders/border.bits.db", e_config_user_dir());
/* do it for data... ut not all of it for now.. i'm considering if */
/* this is a godo idea. config data - YES. but raw theme data? */
if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/appearance/default/borders/border.bits.db", buf);
sprintf(buf, "%sappearance/borders/border2.bits.db", e_config_user_dir());
if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/appearance/default/borders/border2.bits.db", buf);
sprintf(buf, "%sappearance/borders/borderless.bits.db", e_config_user_dir());
if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/appearance/default/borders/borderless.bits.db", buf);
#endif
}

@ -183,7 +183,7 @@ e_desktops_init_file_display(E_Desktop *desk)
/* fixme: later */
/* uncomment this and comment out the next line for some tress testing */
/* desk->view->dir = strdup("/dev"); */
desk->view->dir = strdup(e_file_home());
e_strdup(desk->view->dir, e_file_home());
e_view_realize(desk->view);
if (desk->view->options.back_pixmap)

@ -25,6 +25,16 @@
#include <Ecore.h>
#include <Edb.h>
#if 0
#include <execinfo.h>
#define BT \
{ \
void *__BT_array[250]; \
int __BT_n = backtrace(__BT_array,250); \
backtrace_symbols_fd(__BT_array, __BT_n, fileno(stdout)); \
}
#endif
/* macros for allowing sections of code to be runtime profiled */
#define E_PROF 1
#ifdef E_PROF

@ -1,6 +1,7 @@
#include "e.h"
#include "border.h"
#include "icccm.h"
#include "util.h"
/* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0)
@ -314,7 +315,7 @@ e_icccm_get_title(Window win, E_Border *b)
}
b->client.title = NULL;
if (title) b->client.title = title;
else b->client.title = strdup("No Title");
else e_strdup(b->client.title, "No Title");
}
void

@ -83,33 +83,46 @@ char *
e_file_real(char *file)
{
char buf[4096];
char *f;
if (!realpath(file, buf)) return strdup("");
return strdup(buf);
e_strdup(f, buf);
return f;
}
char *
e_file_get_file(char *file)
{
char *p;
/* char buf[4096]; */
char *f;
p = strrchr(file, '/');
if (!p) return strdup(file);
return strdup(&(p[1]));
if (!p)
{
e_strdup(f, file);
return f;
}
e_strdup(f, &(p[1]));
return f;
}
char *
e_file_get_dir(char *file)
{
char *p;
char *f;
char buf[4096];
strcpy(buf, file);
p = strrchr(buf, '/');
if (!p) return strdup(file);
if (!p)
{
e_strdup(f, file);
return f;
}
*p = 0;
return strdup(buf);
e_strdup(f, buf);
return f;
}
void *
@ -162,11 +175,13 @@ char *
e_file_link(char *link)
{
char buf[4096];
char *f;
int count;
if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
buf[count] = 0;
return strdup(buf);
e_strdup(f, buf);
return f;
}
Evas_List
@ -185,18 +200,21 @@ e_file_list_dir(char *dir)
(strcmp(dp->d_name, "..")))
{
Evas_List l;
char *f;
/* insertion sort */
for (l = list; l; l = l->next)
{
if (strcmp(l->data, dp->d_name) > 0)
{
list = evas_list_prepend_relative(list, strdup(dp->d_name), l->data);
e_strdup(f, dp->d_name);
list = evas_list_prepend_relative(list, f, l->data);
break;
}
}
/* nowhwre to go? just append it */
if (!l) list = evas_list_append(list, strdup(dp->d_name));
e_strdup(f, dp->d_name);
if (!l) list = evas_list_append(list, f);
}
}
closedir(dirp);

@ -19,4 +19,12 @@ int e_file_can_exec(struct stat *st);
char *e_file_link(char *link);
Evas_List e_file_list_dir(char *dir);
#define e_strdup(__dest, __var) \
{ \
if (!__var) __dest = NULL; \
else { \
__dest = malloc(strlen(__var) + 1); \
if (__dest) strcpy(__dest, __var); \
} }
#endif

@ -341,6 +341,10 @@ e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
}
}
else if (_b == 2)
{
exit(0);
}
else if (_b == 3)
{
static E_Build_Menu *buildmenu = NULL;
@ -1142,8 +1146,9 @@ e_configure(Eevent * ev)
}
}
printf("size %ix%i\n", e->w, e->h);
if ((e->w != v->size.w) || (e->h != v->size.h))
if ((e->w != v->size.w) || (e->h != v->size.h) || (v->size.force))
{
v->size.force = 0;
printf("... a new size!\n");
v->size.w = e->w;
v->size.h = e->h;
@ -1773,7 +1778,8 @@ e_view_arrange(E_View *v)
E_Icon *ic;
ic = l->data;
if ((x != v->spacing.window.l) && ((x + ic->geom.w) > v->size.w))
if ((x != v->spacing.window.l) &&
((x + ic->geom.w) > v->size.w - v->spacing.window.r))
{
x = v->spacing.window.l;
y += ic->geom.h + v->spacing.icon.b;
@ -2542,9 +2548,12 @@ e_view_handle_fs(EfsdEvent *ev)
{
if (efsd_metadata_get_int(ev,
&(v->size.w)))
e_window_resize(v->win.base,
v->size.w,
v->size.h);
{
e_window_resize(v->win.base,
v->size.w,
v->size.h);
v->size.force = 1;
}
}
}
ok = 1;
@ -2558,9 +2567,12 @@ e_view_handle_fs(EfsdEvent *ev)
{
if (efsd_metadata_get_int(ev,
&(v->size.h)))
e_window_resize(v->win.base,
v->size.w,
v->size.h);
{
e_window_resize(v->win.base,
v->size.w,
v->size.h);
v->size.force = 1;
}
}
}
ok = 1;

@ -29,6 +29,7 @@ struct _E_View
Pixmap pmap;
struct {
int w, h;
int force;
} size;
struct {
int x, y;

Loading…
Cancel
Save