Cleanups, enable compiling everything as if it were C++.

SVN revision: 28022
This commit is contained in:
Kim Woelders 2007-01-17 01:10:44 +00:00
parent 4f8f665bc6
commit f53600e1e8
96 changed files with 5552 additions and 5433 deletions

View File

@ -268,11 +268,22 @@ if test "x$enable_roothacklib" = "xyes"; then
fi
AM_CONDITIONAL(BUILD_ROOTHACKLIB, test "x$enable_roothacklib" = "xyes")
AC_ARG_ENABLE(gcc-cpp,
[ --enable-gcc-cpp compile everything as if it were C++ @<:@default=no@:>@],,
enable_gcc_cpp=no)
if test "x$enable_gcc_cpp" = "xyes"; then
CC="g++"
CPPFLAGS="-x c++"
fi
AC_ARG_ENABLE(gcc-warnings,
[ --enable-gcc-warnings enable GCC compiler warnings @<:@default=no@:>@],,
enable_gcc_warnings=no)
if test "x$enable_gcc_warnings" = "xyes"; then
CFLAGS="$CFLAGS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Waggregate-return -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings #-Wunreachable-code"
CFLAGS="$CFLAGS -W -Wall -Waggregate-return -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings"
if test "x$enable_gcc_cpp" != "xyes"; then
CFLAGS="$CFLAGS -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes"
fi
fi
AC_SUBST(E_X_LIBS)

View File

@ -50,11 +50,11 @@ Root VRoot;
Window win_main, win_title, win_exit, win_next, win_prev, win_text,
win_cover;
Imlib_Image *im_text;
Imlib_Image *im_title;
Imlib_Image *im_prev1, *im_prev2;
Imlib_Image *im_next1, *im_next2;
Imlib_Image *im_exit1, *im_exit2;
Imlib_Image im_text;
Imlib_Image im_title;
Imlib_Image im_prev1, im_prev2;
Imlib_Image im_next1, im_next2;
Imlib_Image im_exit1, im_exit2;
char *docdir = NULL;
static Atom ATOM_WM_DELETE_WINDOW = None;
@ -163,10 +163,10 @@ CreateWindow(Window parent, int x, int y, int ww, int hh)
return win;
}
static Imlib_Image *
static Imlib_Image
LoadImage(const char *file)
{
Imlib_Image *im;
Imlib_Image im;
char tmp[4096];
sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
@ -177,7 +177,7 @@ LoadImage(const char *file)
}
static void
ApplyImage1(Window win, Imlib_Image * im)
ApplyImage1(Window win, Imlib_Image im)
{
Pixmap pmap = 0, mask = 0;
@ -189,7 +189,7 @@ ApplyImage1(Window win, Imlib_Image * im)
}
static void
ApplyImage2(Window win, Imlib_Image * im)
ApplyImage2(Window win, Imlib_Image im)
{
imlib_context_set_image(im);
imlib_context_set_drawable(win);
@ -296,7 +296,8 @@ main(int argc, char **argv)
}
if (docdir == NULL)
docdir = strdup(".");
s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
s = EMALLOC(char, strlen(docdir) + strlen(docfile) + 2 + 20);
sprintf(s, "%s/%s", docdir, docfile);
findLocalizedFile(s);
@ -414,7 +415,8 @@ main(int argc, char **argv)
XMapWindow(disp, win_main);
XSync(disp, False);
page_hist = malloc(sizeof(int));
page_hist = EMALLOC(int, 1);
page_hist[0] = 0;
@ -529,7 +531,8 @@ main(int argc, char **argv)
if (dirlen > 1)
{
free(docdir);
docdir = malloc(dirlen + 1);
docdir = EMALLOC(char, dirlen + 1);
memcpy(docdir, exe, dirlen);
docdir[dirlen] = 0;
}
@ -537,7 +540,7 @@ main(int argc, char **argv)
pclose(p);
if (page_hist)
free(page_hist);
page_hist = malloc(sizeof(int));
page_hist = EMALLOC(int, 1);
page_hist[0] = 0;
page_hist_len = 1;
@ -560,9 +563,8 @@ main(int argc, char **argv)
{
page_hist_len++;
page_hist =
realloc(page_hist,
sizeof(int) *
page_hist_len);
EREALLOC(int, page_hist,
page_hist_len);
}
page_hist[page_hist_pos] = pagenum;
l = RenderPage(draw, pagenum, w, h);
@ -602,8 +604,7 @@ main(int argc, char **argv)
if (page_hist_pos >= page_hist_len)
{
page_hist_len++;
page_hist = realloc(page_hist,
sizeof(int) * page_hist_len);
page_hist = EREALLOC(int, page_hist, page_hist_len);
page_hist[page_hist_pos] = pagenum;
}

View File

@ -217,7 +217,11 @@ extern Display *disp;
extern Root VRoot;
extern char *docdir;
#define Emalloc malloc
#define Efree free
#define Efree free
#define Emalloc malloc
#define Erealloc realloc
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))
#define Esnprintf snprintf

View File

@ -58,7 +58,7 @@ void
AddPage(Object * obj)
{
num_pages++;
page = realloc(page, sizeof(Page) * (num_pages));
page = EREALLOC(Page, page, num_pages);
page[num_pages - 1].name = NULL;
page[num_pages - 1].count = 0;
page[num_pages - 1].obj = NULL;
@ -91,8 +91,7 @@ AddObject(Object * obj)
{
page[num_pages - 1].count++;
page[num_pages - 1].obj =
realloc(page[num_pages - 1].obj,
sizeof(Object) * (page[num_pages - 1].count));
EREALLOC(Object, page[num_pages - 1].obj, page[num_pages - 1].count);
page[num_pages - 1].obj[page[num_pages - 1].count - 1].type = obj->type;
page[num_pages - 1].obj[page[num_pages - 1].count - 1].object = obj->object;
}
@ -110,7 +109,8 @@ BuildObj(Object * obj, char *var, char *param)
case IMG:
if (!obj->object)
{
img = obj->object = malloc(sizeof(Img_));
img = EMALLOC(Img_, 1);
obj->object = img;
img->src = NULL;
img->src2 = NULL;
img->src3 = NULL;
@ -138,7 +138,8 @@ BuildObj(Object * obj, char *var, char *param)
case FONT:
if (!obj->object)
{
fn = obj->object = malloc(sizeof(Font_));
fn = EMALLOC(Font_, 1);
obj->object = fn;
fn->face = NULL;
fn->r = 0;
fn->g = 0;
@ -167,7 +168,8 @@ BuildObj(Object * obj, char *var, char *param)
case P:
if (!obj->object)
{
p = obj->object = malloc(sizeof(P_));
p = EMALLOC(P_, 1);
obj->object = p;
p->align = 0;
}
if (!strcmp(var, "align"))
@ -182,7 +184,8 @@ BuildObj(Object * obj, char *var, char *param)
case PAGE:
if (!obj->object)
{
pg = obj->object = malloc(sizeof(Page));
pg = EMALLOC(Page, 1);
obj->object = pg;
pg->columns = 1;
pg->padding = 1;
pg->name = NULL;
@ -354,9 +357,11 @@ GetObjects(FILE * f)
while ((count = fread(buf, 1, 4096, f)) > 0)
{
if (!fdat)
fdat = malloc(count);
fdat = EMALLOC(char, count);
else
fdat = realloc(fdat, (fdat_size + count));
fdat = EREALLOC(char, fdat, fdat_size + count);
memcpy(fdat + fdat_size, buf, count);
fdat_size += count;
}
@ -513,7 +518,7 @@ RenderPage(Window win, int page_num, int w, int h)
int x, y;
int justification = 0;
int firstp = 1;
Imlib_Image *im;
Imlib_Image im;
int wastext = 0;
ts.fontname = NULL;
@ -557,7 +562,7 @@ RenderPage(Window win, int page_num, int w, int h)
switch (pg->obj[i].type)
{
case IMG:
img = pg->obj[i].object;
img = (Img_ *) pg->obj[i].object;
if (img->src)
{
char tmp[4096];
@ -578,7 +583,7 @@ RenderPage(Window win, int page_num, int w, int h)
{
Link *l;
l = malloc(sizeof(Link));
l = EMALLOC(Link, 1);
l->name = strdup(img->link);
l->x = img->x;
l->y = img->y;
@ -595,7 +600,7 @@ RenderPage(Window win, int page_num, int w, int h)
wastext = 0;
break;
case FONT:
fn = pg->obj[i].object;
fn = (Font_ *) pg->obj[i].object;
ts.fontname = NULL;
ESetColor(&ts.fg_col, 0, 0, 0);
ESetColor(&ts.bg_col, 0, 0, 0);
@ -616,7 +621,7 @@ RenderPage(Window win, int page_num, int w, int h)
TextStateLoadFont(&ts);
break;
case P:
p = pg->obj[i].object;
p = (P_ *) pg->obj[i].object;
if (p)
justification = (int)((p->align / 100) * 1024);
else
@ -627,7 +632,7 @@ RenderPage(Window win, int page_num, int w, int h)
firstp = 0;
break;
case TEXT:
txt = pg->obj[i].object;
txt = (char *)pg->obj[i].object;
wc = 1;
ss[0] = 0;
s[0] = 0;
@ -741,7 +746,7 @@ RenderPage(Window win, int page_num, int w, int h)
{
if (pg->obj[j].type == IMG)
{
img = pg->obj[j].object;
img = (Img_ *) pg->obj[j].object;
if ((img->w > 0) && (img->h > 0))
{
int ix, iy, iix, iiy;
@ -846,7 +851,8 @@ RenderPage(Window win, int page_num, int w, int h)
{
if (pg->obj[j].type == IMG)
{
img = pg->obj[j].object;
img =
(Img_ *) pg->obj[j].object;
if ((img->w > 0)
&& (img->h > 0))
{
@ -950,7 +956,7 @@ RenderPage(Window win, int page_num, int w, int h)
{
Link *l;
l = malloc(sizeof(Link));
l = EMALLOC(Link, 1);
l->name = strdup(link_link);
l->x = x + off + lx + extra;
l->y = y;

View File

@ -41,8 +41,8 @@ TextGetLines(const char *text, int *count)
while ((text[j]) && (text[j] != '\n'))
j++;
k++;
list = realloc(list, sizeof(char *) * k);
list[k - 1] = malloc(sizeof(char) * (j - i + 1));
list = EREALLOC(char *, list, k);
list[k - 1] = EMALLOC(char, j - i + 1);
strncpy(list[k - 1], &(text[i]), (j - i));
list[k - 1][j - i] = 0;

View File

@ -24,7 +24,7 @@
struct _efont
{
Imlib_Font *face;
Imlib_Font face;
};
static void
@ -80,14 +80,14 @@ Efont_load(const char *file, int size)
{
char s[4096];
Efont *f;
Imlib_Font *ff;
Imlib_Font ff;
Esnprintf(s, sizeof(s), "%s/%d", file, size);
ff = imlib_load_font(s);
if (ff == NULL)
return NULL;
f = Emalloc(sizeof(Efont));
f = EMALLOC(Efont, 1);
f->face = ff;
return f;

View File

@ -38,12 +38,11 @@
#define USE_LIBC_STRDUP 1 /* Use libc strdup if present */
#endif
typedef struct _client
typedef struct
{
Window win;
char *msg;
}
Client;
} Client;
Window CommsSetup(void);
Window CommsFindCommsWindow(void);
@ -55,10 +54,13 @@ void ClientDestroy(Client * c);
void Alert(const char *fmt, ...);
#define Ecalloc calloc
#define Emalloc malloc
#define Efree free
#define Emalloc malloc
#define Erealloc realloc
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))
#if USE_LIBC_STRDUP
#define Estrdup(s) ((s) ? strdup(s) : NULL)
#else

View File

@ -150,7 +150,8 @@ CommsGet(Client * c, XEvent * ev)
if (c->msg)
{
/* append text to end of msg */
c->msg = Erealloc(c->msg, strlen(c->msg) + strlen(s) + 1);
c->msg = EREALLOC(char, c->msg, strlen(c->msg) + strlen(s) + 1);
if (!c->msg)
return NULL;
strcat(c->msg, s);
@ -158,7 +159,8 @@ CommsGet(Client * c, XEvent * ev)
else
{
/* new msg */
c->msg = Emalloc(strlen(s) + 1);
c->msg = EMALLOC(char, strlen(s) + 1);
if (!c->msg)
return NULL;
strcpy(c->msg, s);
@ -177,7 +179,7 @@ ClientCreate(Window win)
{
Client *c;
c = Emalloc(sizeof(Client));
c = EMALLOC(Client, 1);
if (!c)
return NULL;

View File

@ -173,7 +173,8 @@ main(int argc, char **argv)
for (; i < argc; i++)
{
l = strlen(argv[i]);
command = Erealloc(command, len + l + 2);
command = EREALLOC(char, command, len + l + 2);
if (len)
command[len++] = ' ';
strcpy(command + len, argv[i]);
@ -264,7 +265,7 @@ Estrdup(const char *s)
if (!s)
return NULL;
sz = strlen(s);
ss = Emalloc(sz + 1);
ss = EMALLOC(char, sz + 1);
strncpy(ss, s, sz + 1);
return ss;

View File

@ -56,34 +56,44 @@ MyRoot(Display * dpy)
return root;
}
typedef Window(CWF) (Display * _display, Window _parent, int _x,
int _y, unsigned int _width,
unsigned int _height,
unsigned int _border_width, int _depth,
unsigned int _class, Visual * _visual,
unsigned long _valuemask,
XSetWindowAttributes * _attributes);
/* XCreateWindow intercept hack */
Window
XCreateWindow(Display * display, Window parent, int x, int y,
unsigned int width, unsigned int height,
unsigned int border_width,
int depth, unsigned int class, Visual * visual,
int depth, unsigned int clss, Visual * visual,
unsigned long valuemask, XSetWindowAttributes * attributes)
{
static Window(*func)
(Display * _display, Window _parent, int _x, int _y,
unsigned int _width, unsigned int _height,
unsigned int _border_width,
int _depth, unsigned int _class, Visual * _visual,
unsigned long _valuemask, XSetWindowAttributes * _attributes) = NULL;
static CWF *func = NULL;
/* find the real Xlib and the real X function */
if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func)
func = dlsym(lib_xlib, "XCreateWindow");
func = (CWF *) dlsym(lib_xlib, "XCreateWindow");
if (parent == DefaultRootWindow(display))
parent = MyRoot(display);
return (*func) (display, parent, x, y, width, height, border_width, depth,
class, visual, valuemask, attributes);
clss, visual, valuemask, attributes);
}
typedef Window(CSWF) (Display * _display, Window _parent, int _x,
int _y, unsigned int _width,
unsigned int _height,
unsigned int _border_width,
unsigned long _border,
unsigned long _background);
/* XCreateSimpleWindow intercept hack */
Window
XCreateSimpleWindow(Display * display, Window parent, int x, int y,
@ -91,17 +101,13 @@ XCreateSimpleWindow(Display * display, Window parent, int x, int y,
unsigned int border_width,
unsigned long border, unsigned long background)
{
static Window(*func)
(Display * _display, Window _parent, int _x, int _y,
unsigned int _width, unsigned int _height,
unsigned int _border_width,
unsigned long _border, unsigned long _background) = NULL;
static CSWF *func = NULL;
/* find the real Xlib and the real X function */
if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func)
func = dlsym(lib_xlib, "XCreateSimpleWindow");
func = (CSWF *) dlsym(lib_xlib, "XCreateSimpleWindow");
if (parent == DefaultRootWindow(display))
parent = MyRoot(display);
@ -110,19 +116,20 @@ XCreateSimpleWindow(Display * display, Window parent, int x, int y,
border_width, border, background);
}
typedef int (RWF) (Display * _display, Window _window, Window _parent,
int x, int y);
/* XReparentWindow intercept hack */
int
XReparentWindow(Display * display, Window window, Window parent, int x, int y)
{
static int (*func)
(Display * _display, Window _window, Window _parent, int _x, int _y) =
NULL;
static RWF *func = NULL;
/* find the real Xlib and the real X function */
if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func)
func = dlsym(lib_xlib, "XReparentWindow");
func = (RWF *) dlsym(lib_xlib, "XReparentWindow");
if (parent == DefaultRootWindow(display))
parent = MyRoot(display);

554
po/bg.po

File diff suppressed because it is too large Load Diff

554
po/bs.po

File diff suppressed because it is too large Load Diff

554
po/da.po

File diff suppressed because it is too large Load Diff

554
po/de.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

554
po/es.po

File diff suppressed because it is too large Load Diff

554
po/fr.po

File diff suppressed because it is too large Load Diff

554
po/hu.po

File diff suppressed because it is too large Load Diff

554
po/ja.po

File diff suppressed because it is too large Load Diff

554
po/ko.po

File diff suppressed because it is too large Load Diff

554
po/nl.po

File diff suppressed because it is too large Load Diff

554
po/no.po

File diff suppressed because it is too large Load Diff

554
po/pl.po

File diff suppressed because it is too large Load Diff

554
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

554
po/ru.po

File diff suppressed because it is too large Load Diff

554
po/sv.po

File diff suppressed because it is too large Load Diff

554
po/tr.po

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,9 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "config.h"
#include "alert.h"
@ -62,9 +64,6 @@
#define ENABLE_TRANSPARENCY 1
#define ENABLE_THEME_TRANSPARENCY 1
/* dmalloc debugging */
/*#include <dmalloc.h> */
/* sgi's stdio.h has:
*
* #if _SGIAPI && _NO_ANSIMODE

View File

@ -94,7 +94,7 @@ ActionCreate(char event, char anymod, int mod, int anybut, int but,
{
Action *aa;
aa = Emalloc(sizeof(Action));
aa = EMALLOC(Action, 1);
aa->action = NULL;
aa->event = event;
aa->anymodifier = anymod;
@ -136,7 +136,7 @@ ActionAddTo(Action * aa, const char *params)
{
ActionType *pptr, *ptr, *at;
at = Emalloc(sizeof(ActionType));
at = EMALLOC(ActionType, 1);
if (!at)
return;
at->next = NULL;
@ -163,10 +163,7 @@ void
ActionclassAddAction(ActionClass * ac, Action * aa)
{
ac->num++;
if (!ac->list)
ac->list = Emalloc(sizeof(Action *));
else
ac->list = Erealloc(ac->list, ac->num * sizeof(Action *));
ac->list = EREALLOC(Action *, ac->list, ac->num);
ac->list[ac->num - 1] = aa;
}
@ -175,7 +172,7 @@ ActionclassCreate(const char *name, int global)
{
ActionClass *ac;
ac = Ecalloc(1, sizeof(ActionClass));
ac = ECALLOC(ActionClass, 1);
ac->name = Estrdup(name);
if (global)
@ -227,19 +224,21 @@ ActionclassDestroy(ActionClass * ac)
static int
_ActionclassMatchName(const void *data, const void *match)
{
return strcmp(((const ActionClass *)data)->name, match);
return strcmp(((const ActionClass *)data)->name, (const char *)match);
}
static ActionClass *
ActionclassFindGlobal(const char *name)
{
return ecore_list_find(aclass_list_global, _ActionclassMatchName, name);
return (ActionClass *) ecore_list_find(aclass_list_global,
_ActionclassMatchName, name);
}
ActionClass *
ActionclassFind(const char *name)
{
return ecore_list_find(aclass_list, _ActionclassMatchName, name);
return (ActionClass *) ecore_list_find(aclass_list, _ActionclassMatchName,
name);
}
static ActionClass *
@ -247,10 +246,12 @@ ActionclassFindAny(const char *name)
{
ActionClass *ac;
ac = ecore_list_find(aclass_list_global, _ActionclassMatchName, name);
ac = (ActionClass *) ecore_list_find(aclass_list_global,
_ActionclassMatchName, name);
if (ac)
return ac;
return ecore_list_find(aclass_list, _ActionclassMatchName, name);
return (ActionClass *) ecore_list_find(aclass_list, _ActionclassMatchName,
name);
}
int
@ -332,10 +333,12 @@ AclassConfigLoad(FILE * fs)
case CONFIG_CLASSNAME:
case ACLASS_NAME:
ac = ecore_list_remove_node(aclass_list, ActionclassFind(s2));
ac = (ActionClass *) ecore_list_remove_node(aclass_list,
ActionclassFind(s2));
if (!ac)
ac = ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal(s2));
ac = (ActionClass *) ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal
(s2));
if (ac)
{
if (!strcmp(s2, "KEYBINDINGS"))
@ -747,11 +750,13 @@ AclassConfigLoad2(FILE * fs)
}
else
{
ac =
ecore_list_remove_node(aclass_list, ActionclassFind(prm2));
ac = (ActionClass *) ecore_list_remove_node(aclass_list,
ActionclassFind
(prm2));
if (!ac)
ac = ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal(prm2));
ac = (ActionClass *)
ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal(prm2));
if (ac)
ActionclassDestroy(ac);
ac = NULL;
@ -1337,8 +1342,9 @@ IPC_KeybindingsSet(const char *params, Client * c __UNUSED__)
Mode.keybinds_changed = 1;
ac = ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal("KEYBINDINGS"));
ac = (ActionClass *) ecore_list_remove_node(aclass_list_global,
ActionclassFindGlobal
("KEYBINDINGS"));
if (ac)
ActionclassDestroy(ac);
@ -1449,6 +1455,7 @@ static const IpcItem AclassIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModAclass;
const EModule ModAclass = {
"aclass", "ac",
AclassSighan,

View File

@ -69,7 +69,8 @@ execApplication(const char *params, int flags)
if (path_canexec(exe))
{
real_exec = Emalloc(strlen(params) + 6);
real_exec = EMALLOC(char, strlen(params) + 6);
if (!real_exec)
return -1;
sprintf(real_exec, "exec %s", params);

View File

@ -153,7 +153,7 @@ AlertButtonText(int btn, const char *text)
if (!text)
return NULL;
s = Emalloc(strlen(text) + 6);
s = EMALLOC(char, strlen(text) + 6);
if (!s)
return NULL;

View File

@ -347,13 +347,14 @@ ArrangeRects(const RectBox * fixed, int fixed_count, RectBox * floating,
/* for every floating rect in order, "fit" it into the sorted list */
i = ((fixed_count + floating_count) * 2) + 2;
xarray = Emalloc(i * sizeof(int));
yarray = Emalloc(i * sizeof(int));
filled = Emalloc(i * i * sizeof(char));
spaces = Emalloc(i * i * sizeof(RectBox));
xarray = EMALLOC(int, i);
yarray = EMALLOC(int, i);
filled = EMALLOC(unsigned char, i * i);
spaces = EMALLOC(RectBox, i * i);
leftover = NULL;
if (floating_count)
leftover = Emalloc(floating_count * sizeof(int));
leftover = EMALLOC(int, floating_count);
if (!xarray || !yarray || !filled || !spaces)
goto done;
@ -559,7 +560,7 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
lst1 = EwinListOrderGet(&num);
if (lst1)
{
lst = malloc(num * sizeof(EWin *));
lst = EMALLOC(EWin *, num);
if (!lst)
return;
memcpy(lst, lst1, num * sizeof(EWin *));
@ -787,7 +788,7 @@ ArrangeGetRectList(RectBox ** pfixed, int *nfixed, RectBox ** pfloating,
if (!lst)
goto done;
fixed = Emalloc(sizeof(RectBox) * num);
fixed = EMALLOC(RectBox, num);
if (!fixed)
goto done;
rb = fixed;
@ -823,8 +824,7 @@ ArrangeGetRectList(RectBox ** pfixed, int *nfixed, RectBox ** pfloating,
if (!EoIsSticky(ew) && !EoIsFloating(ew) &&
ew->area_x == ax && ew->area_y == ay)
{
floating =
Erealloc(floating, (nflt + 1) * sizeof(RectBox));
floating = EREALLOC(RectBox, floating, nflt + 1);
rb = floating + nflt++;
rb->data = ew;
rb->x = EoGetX(ew);
@ -934,7 +934,7 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
newrect.h = EoGetH(ewin);
newrect.p = EoGetLayer(ewin);
ret = Emalloc(sizeof(RectBox) * (num + 1));
ret = EMALLOC(RectBox, num + 1);
ArrangeRects(fixed, num, &newrect, 1, ret, 0, 0, VRoot.w, VRoot.h,
ARRANGE_BY_SIZE, 1);
@ -993,7 +993,7 @@ ArrangeEwins(const char *params)
ArrangeGetRectList(&fixed, &nfix, &floating, &nflt, NULL);
ret = Emalloc(sizeof(RectBox) * (nflt + nfix));
ret = EMALLOC(RectBox, nflt + nfix);
ArrangeRects(fixed, nfix, floating, nflt, ret, 0, 0, VRoot.w, VRoot.h,
method, 1);

View File

@ -32,6 +32,7 @@
#include "file.h"
#include "iclass.h"
#include "parse.h"
#include "settings.h"
#include "tclass.h"
#include "timers.h"
#include "xwin.h"
@ -294,7 +295,7 @@ BackgroundCreate(const char *name, XColor * solid, const char *bgn, char tile,
{
Background *bg;
bg = Ecalloc(1, sizeof(Background));
bg = ECALLOC(Background, 1);
if (!bg)
return NULL;
@ -371,19 +372,19 @@ BackgroundCmp(Background * bg, Background * bgx)
static int
_BackgroundMatchName(const void *data, const void *match)
{
return strcmp(((const Background *)data)->name, match);
return strcmp(((const Background *)data)->name, (const char *)match);
}
Background *
BackgroundFind(const char *name)
{
return ecore_list_find(bg_list, _BackgroundMatchName, name);
return (Background *) ecore_list_find(bg_list, _BackgroundMatchName, name);
}
static Background *
BackgroundCheck(Background * bg)
{
return ecore_list_goto(bg_list, bg);
return (Background *) ecore_list_goto(bg_list, bg);
}
void
@ -1063,7 +1064,7 @@ BackgroundGetRandom(void)
for (;;)
{
rnd = rand();
bg = ecore_list_goto_index(bg_list, rnd % num);
bg = (Background *) ecore_list_goto_index(bg_list, rnd % num);
if (num <= 1 || !BackgroundIsNone(bg))
break;
}
@ -1337,7 +1338,7 @@ BackgroundsConfigSave(void)
for (i = num - 1; i >= 0; i--)
{
bg = ecore_list_goto_index(bg_list, i);
bg = (Background *) ecore_list_goto_index(bg_list, i);
if (!bg)
continue;
@ -1418,10 +1419,10 @@ BackgroundsCheckDups(void)
for (ix = 0;; ix++)
{
ecore_list_goto_index(bg_list, ix);
bg = ecore_list_next(bg_list);
bg = (Background *) ecore_list_next(bg_list);
if (!bg)
break;
for (; (bgx = ecore_list_next(bg_list)) != NULL;)
for (; (bgx = (Background *) ecore_list_next(bg_list)) != NULL;)
{
if (bgx->ref_count > 0 || bgx->referenced)
continue;
@ -1733,12 +1734,14 @@ CB_ConfigureDelBG(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
if (num <= 1)
return;
bg = ecore_list_goto(bg_list, tmp_bg);
bg = (Background *) ecore_list_goto(bg_list, tmp_bg);
if (!bg)
return;
i = ecore_list_index(bg_list);
bg = ecore_list_goto_index(bg_list, (i < num - 1) ? i + 1 : i - 1);
bg =
(Background *) ecore_list_goto_index(bg_list,
(i < num - 1) ? i + 1 : i - 1);
DeskBackgroundSet(DesksGetCurrent(), bg);
@ -1886,7 +1889,7 @@ CB_BGAreaEvent(DItem * di __UNUSED__, int val __UNUSED__, void *data)
num = ecore_list_nodes(bg_list);
x = (num * (64 + 8) - w) * tmp_bg_sel_sliderval / (4 * num) +
ev->xbutton.x;
bg = ecore_list_goto_index(bg_list, x / (64 + 8));
bg = (Background *) ecore_list_goto_index(bg_list, x / (64 + 8));
if (!bg || bg == DeskBackgroundGet(DesksGetCurrent()))
break;
BgDialogSetNewCurrent(bg);
@ -1919,7 +1922,7 @@ BGSettingsGoTo(Background * bg)
if (!bg_sel_slider)
return;
bg = ecore_list_goto(bg_list, bg);
bg = (Background *) ecore_list_goto(bg_list, bg);
if (!bg)
return;
@ -1940,11 +1943,13 @@ CB_BGNext(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
{
Background *bg;
bg = ecore_list_goto(bg_list, tmp_bg);
bg = (Background *) ecore_list_goto(bg_list, tmp_bg);
if (!bg)
return;
bg = ecore_list_goto_index(bg_list, ecore_list_index(bg_list) + val);
bg =
(Background *) ecore_list_goto_index(bg_list,
ecore_list_index(bg_list) + val);
if (!bg)
return;
@ -2079,7 +2084,7 @@ CB_InitView(DItem * di __UNUSED__, int val __UNUSED__, void *data __UNUSED__)
static void
_DlgFillBackground(Dialog * d, DItem * table, void *data)
{
Background *bg = data;
Background *bg = (Background *) data;
DItem *di, *table2, *area, *slider, *slider2, *label;
DItem *w1, *w2, *w3, *w4, *w5, *w6;
int num;
@ -2738,6 +2743,7 @@ static const CfgItem BackgroundsCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModBackgrounds;
const EModule ModBackgrounds = {
"backgrounds", "bg",
BackgroundsSighan,

View File

@ -514,7 +514,7 @@ EwinBorderSetTo(EWin * ewin, const Border * b)
EventCallbackRegister(EoGetWin(ewin), 0, BorderFrameHandleEvents, ewin);
if (b->num_winparts > 0)
ewin->bits = Emalloc(sizeof(EWinBit) * b->num_winparts);
ewin->bits = EMALLOC(EWinBit, b->num_winparts);
for (i = 0; i < b->num_winparts; i++)
{
@ -562,7 +562,7 @@ EwinBorderSetTo(EWin * ewin, const Border * b)
Window *wl;
int j = 0;
wl = Emalloc((b->num_winparts + 1) * sizeof(Window));
wl = EMALLOC(Window, b->num_winparts + 1);
for (i = b->num_winparts - 1; i >= 0; i--)
{
if (b->part[i].ontop)
@ -623,7 +623,7 @@ BorderCreate(const char *name)
{
Border *b;
b = Ecalloc(1, sizeof(Border));
b = ECALLOC(Border, 1);
if (!b)
return NULL;
@ -680,13 +680,13 @@ BorderDestroy(Border * b)
static int
_BorderMatchName(const void *data, const void *match)
{
return strcmp(((const Border *)data)->name, match);
return strcmp(((const Border *)data)->name, (const char *)match);
}
Border *
BorderFind(const char *name)
{
return ecore_list_find(border_list, _BorderMatchName, name);
return (Border *) ecore_list_find(border_list, _BorderMatchName, name);
}
static void
@ -702,7 +702,7 @@ BorderWinpartAdd(Border * b, ImageClass * iclass, ActionClass * aclass,
b->num_winparts++;
n = b->num_winparts;
b->part = Erealloc(b->part, n * sizeof(WinPart));
b->part = EREALLOC(WinPart, b->part, n);
if (!iclass)
iclass = ImageclassFind(NULL, 0);

View File

@ -128,7 +128,7 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
if (sticky && ontop == 1)
desk = 0;
b = Ecalloc(1, sizeof(Button));
b = ECALLOC(Button, 1);
if (!button_list)
button_list = ecore_list_new();
@ -217,13 +217,13 @@ ButtonDestroy(Button * b)
static int
_ButtonMatchName(const void *data, const void *match)
{
return strcmp(EoGetName((const Button *)data), match);
return strcmp(EoGetName((const Button *)data), (const char *)match);
}
Button *
ButtonFind(const char *name)
{
return ecore_list_find(button_list, _ButtonMatchName, name);
return (Button *) ecore_list_find(button_list, _ButtonMatchName, name);
}
static void
@ -626,7 +626,7 @@ ButtonEventMouseOut(Button * b, XEvent * ev)
static ActionClass *
ButtonGetAclass(void *data)
{
Button *b = data;
Button *b = (Button *) data;
/* Validate button */
if (!ecore_list_goto(button_list, b))
@ -1025,8 +1025,8 @@ typedef struct
static void
_ButtonHideShow(void *data, void *prm)
{
Button *b = data;
button_match_data *bmd = prm;
Button *b = (Button *) data;
button_match_data *bmd = (button_match_data *) prm;
int match;
if (bmd->id >= 0 && bmd->id != b->id)
@ -1166,6 +1166,7 @@ static const CfgItem ButtonsCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModButtons;
const EModule ModButtons = {
"buttons", "btn",
ButtonsSighan,

View File

@ -52,7 +52,7 @@ ClientCreate(Window xwin)
Client *c;
char st[32];
c = Ecalloc(1, sizeof(Client));
c = ECALLOC(Client, 1);
if (!c)
return NULL;
@ -177,7 +177,7 @@ ClientCommsGet(Client ** c, XClientMessageEvent * ev)
for (i = 0; i < 12; i++)
s[i] = ev->data.b[i + 8];
sscanf(s2, "%lx", &win);
cl = ecore_list_find(client_list, ClientMatchWindow, (void *)win);
cl = (Client *) ecore_list_find(client_list, ClientMatchWindow, (void *)win);
if (!cl)
{
cl = ClientCreate(win);
@ -188,7 +188,8 @@ ClientCommsGet(Client ** c, XClientMessageEvent * ev)
if (cl->msg)
{
/* append text to end of msg */
cl->msg = Erealloc(cl->msg, strlen(cl->msg) + strlen(s) + 1);
cl->msg = EREALLOC(char, cl->msg, strlen(cl->msg) + strlen(s) + 1);
if (!cl->msg)
return NULL;
strcat(cl->msg, s);
@ -196,7 +197,8 @@ ClientCommsGet(Client ** c, XClientMessageEvent * ev)
else
{
/* new msg */
cl->msg = Emalloc(strlen(s) + 1);
cl->msg = EMALLOC(char, strlen(s) + 1);
if (!cl->msg)
return NULL;
strcpy(cl->msg, s);

View File

@ -71,7 +71,8 @@ GetLine(char *s, int size, FILE * f)
if (buffer == NULL)
{
buffer = Emalloc(LINE_BUFFER_SIZE);
buffer = EMALLOC(char, LINE_BUFFER_SIZE);
if (buffer == NULL)
return NULL;
buffer[LINE_BUFFER_SIZE - 1] = '\0';

View File

@ -55,13 +55,14 @@ Ecore_List *container_list = NULL;
static int
_ContainerMatchName(const void *data, const void *match)
{
return strcmp(((const Container *)data)->name, match);
return strcmp(((const Container *)data)->name, (const char *)match);
}
static Container *
ContainerFind(const char *name)
{
return ecore_list_find(container_list, _ContainerMatchName, name);
return (Container *) ecore_list_find(container_list, _ContainerMatchName,
name);
}
static Container *
@ -72,7 +73,7 @@ ContainerCreate(const char *name)
if (ContainerFind(name))
return NULL;
ct = Ecalloc(1, sizeof(Container));
ct = ECALLOC(Container, 1);
if (!ct)
return NULL;
@ -241,7 +242,7 @@ ContainerReconfigure(Container * ct)
static void
ContainerEwinLayout(EWin * ewin, int *px, int *py, int *pw, int *ph)
{
Container *ct = ewin->data;
Container *ct = (Container *) ewin->data;
ContainerLayout(ct, px, py, pw, ph);
@ -252,7 +253,7 @@ ContainerEwinLayout(EWin * ewin, int *px, int *py, int *pw, int *ph)
static void
ContainerEwinMoveResize(EWin * ewin, int resize)
{
Container *ct = ewin->data;
Container *ct = (Container *) ewin->data;
if (!resize && !ct->do_update && !TransparencyUpdateNeeded())
return;
@ -267,7 +268,7 @@ ContainerEwinMoveResize(EWin * ewin, int resize)
static void
ContainerEwinClose(EWin * ewin)
{
ContainerDestroy(ewin->data, 0);
ContainerDestroy((Container *) ewin->data, 0);
ewin->client.win = NULL;
ewin->data = NULL;
}
@ -354,7 +355,7 @@ ContainerObjectAdd(Container * ct, void *obj)
return -1;
ct->num_objs++;
ct->objs = Erealloc(ct->objs, sizeof(ContainerObject) * ct->num_objs);
ct->objs = EREALLOC(ContainerObject, ct->objs, ct->num_objs);
ct->objs[ct->num_objs - 1].obj = obj;
return ct->num_objs - 1; /* Success */
@ -374,7 +375,7 @@ ContainerObjectDel(Container * ct, void *obj)
ct->objs[j] = ct->objs[j + 1];
ct->num_objs--;
if (ct->num_objs > 0)
ct->objs = Erealloc(ct->objs, sizeof(ContainerObject) * ct->num_objs);
ct->objs = EREALLOC(ContainerObject, ct->objs, ct->num_objs);
else
{
Efree(ct->objs);
@ -1527,10 +1528,9 @@ CB_ConfigureContainer(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
static void
CB_IconSizeSlider(Dialog * d, int val __UNUSED__, void *data)
{
DItem *di;
DItem *di = (DItem *) data;
char s[256];
di = data;
Esnprintf(s, sizeof(s), _("Icon size: %2d"), tmp_ib_iconsize);
DialogItemSetText(di, s);
DialogDrawItems(d, di, 0, 0, 99999, 99999);
@ -1539,7 +1539,7 @@ CB_IconSizeSlider(Dialog * d, int val __UNUSED__, void *data)
static void
_DlgFillContainer(Dialog * d, DItem * table, void *data)
{
Container *ct = data;
Container *ct = (Container *) data;
DItem *di, *table2;
DItem *radio1, *radio2, *radio3, *radio4, *label;
char s[256];
@ -2023,6 +2023,7 @@ static const CfgItem ContainersCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModIconboxes;
const EModule ModIconboxes = {
"iconboxes", "ibox",
ContainersSighan,

View File

@ -100,7 +100,7 @@ ECursorCreate(const char *name, const char *image, int native_id, XColor * fg,
curs = (native_id == 999) ? None : XCreateFontCursor(disp, native_id);
}
ec = Emalloc(sizeof(ECursor));
ec = EMALLOC(ECursor, 1);
ec->name = Estrdup(name);
ec->file = Estrdup(image);
ec->cursor = curs;
@ -140,13 +140,13 @@ ECursorDestroy(ECursor * ec)
static int
_ECursorMatchName(const void *data, const void *match)
{
return strcmp(((const ECursor *)data)->name, match);
return strcmp(((const ECursor *)data)->name, (const char *)match);
}
ECursor *
ECursorFind(const char *name)
{
return ecore_list_find(cursor_list, _ECursorMatchName, name);
return (ECursor *) ecore_list_find(cursor_list, _ECursorMatchName, name);
}
static int
@ -395,6 +395,7 @@ static const IpcItem CursorIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModCursors;
const EModule ModCursors = {
"cursor", "csr",
CursorSighan,

View File

@ -36,6 +36,7 @@
#include "grabs.h"
#include "hints.h"
#include "iclass.h"
#include "settings.h"
#include "timers.h"
#include "tooltips.h"
#include "xwin.h"
@ -398,7 +399,7 @@ DeskCreate(int desk, int configure)
if (desk < 0 || desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
return NULL;
dsk = Ecalloc(1, sizeof(Desk));
dsk = ECALLOC(Desk, 1);
desks.desk[desk] = dsk;
dsk->num = desk;
@ -1430,7 +1431,7 @@ DeskRestackSimple(Desk * dsk)
#define _APPEND_TO_WIN_LIST(win) \
{ \
wl = Erealloc(wl, ++tot * sizeof(Window)); \
wl = EREALLOC(Window, wl, ++tot); \
wl[tot - 1] = win; \
}
void
@ -1700,7 +1701,7 @@ DeskCurrentGotoArea(int ax, int ay)
continue;
wnum++;
wl = Erealloc(wl, sizeof(EObj *) * wnum);
wl = EREALLOC(EObj *, wl, wnum);
wl[wnum - 1] = &ewin->o;
}
@ -2938,6 +2939,7 @@ static const CfgItem DesksCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModDesktops;
const EModule ModDesktops = {
"desktops", "desk",
DesksSighan,

View File

@ -221,11 +221,7 @@ DialogBindKey(Dialog * d, const char *key, DialogCallbackFunc * func, int val,
void *data)
{
d->num_bindings++;
if (!d->keybindings)
d->keybindings = Emalloc(sizeof(DKeyBind) * d->num_bindings);
else
d->keybindings =
Erealloc(d->keybindings, sizeof(DKeyBind) * d->num_bindings);
d->keybindings = EREALLOC(DKeyBind, d->keybindings, d->num_bindings);
d->keybindings[d->num_bindings - 1].val = val;
d->keybindings[d->num_bindings - 1].func = func;
d->keybindings[d->num_bindings - 1].data = data;
@ -245,7 +241,7 @@ DialogCreate(const char *name)
{
Dialog *d;
d = Ecalloc(1, sizeof(Dialog));
d = ECALLOC(Dialog, 1);
if (!d)
return NULL;
@ -298,13 +294,13 @@ DialogDestroy(Dialog * d)
static int
_DialogMatchName(const void *data, const void *match)
{
return strcmp(((const Dialog *)data)->name, match);
return strcmp(((const Dialog *)data)->name, (const char *)match);
}
Dialog *
DialogFind(const char *name)
{
return ecore_list_find(dialog_list, _DialogMatchName, name);
return (Dialog *) ecore_list_find(dialog_list, _DialogMatchName, name);
}
void
@ -351,10 +347,10 @@ DialogAddButton(Dialog * d, const char *text, DialogCallbackFunc * func,
int w, h;
EImageBorder *pad;
db = Emalloc(sizeof(DButton));
db = EMALLOC(DButton, 1);
d->num_buttons++;
d->button = Erealloc(d->button, d->num_buttons * (sizeof(DButton *)));
d->button = EREALLOC(DButton *, d->button, d->num_buttons);
d->button[d->num_buttons - 1] = db;
db->parent = d;
@ -509,7 +505,7 @@ DialogRedraw(Dialog * d)
static void
DialogEwinMoveResize(EWin * ewin, int resize __UNUSED__)
{
Dialog *d = ewin->data;
Dialog *d = (Dialog *) ewin->data;
if (!d || Mode.mode != MODE_NONE || !EoIsShown(ewin))
return;
@ -521,7 +517,7 @@ DialogEwinMoveResize(EWin * ewin, int resize __UNUSED__)
static void
DialogEwinClose(EWin * ewin)
{
DialogDestroy(ewin->data);
DialogDestroy((Dialog *) ewin->data);
ewin->client.win = NULL;
ewin->data = NULL;
}
@ -703,7 +699,7 @@ DialogItemCreate(int type)
{
DItem *di;
di = Ecalloc(1, sizeof(DItem));
di = ECALLOC(DItem, 1);
di->type = type;
di->align_h = 512;
@ -839,8 +835,7 @@ DialogAddItem(DItem * dii, int type)
{
dii->item.table.num_items++;
dii->item.table.items =
Erealloc(dii->item.table.items,
sizeof(DItem *) * dii->item.table.num_items);
EREALLOC(DItem *, dii->item.table.items, dii->item.table.num_items);
dii->item.table.items[dii->item.table.num_items - 1] = di;
di->dlg = dii->dlg;
}
@ -1287,8 +1282,8 @@ DialogRealizeItem(Dialog * d, DItem * di)
int i, r, c, x, y;
int *col_size, *row_size;
col_size = Emalloc(sizeof(int) * cols);
row_size = Emalloc(sizeof(int) * rows);
col_size = EMALLOC(int, cols);
row_size = EMALLOC(int, rows);
row_size[0] = 0;
for (i = 0; i < cols; i++)
@ -1321,7 +1316,7 @@ DialogRealizeItem(Dialog * d, DItem * di)
c = 0;
r++;
rows++;
row_size = Erealloc(row_size, sizeof(int) * rows);
row_size = EREALLOC(int, row_size, rows);
row_size[rows - 1] = 0;
}

View File

@ -68,11 +68,11 @@ ECreatePixImg(Window win, int w, int h)
XGCValues gcv;
PixImg *pi;
pi = Emalloc(sizeof(PixImg));
pi = EMALLOC(PixImg, 1);
if (!pi)
return NULL;
pi->shminfo = Emalloc(sizeof(XShmSegmentInfo));
pi->shminfo = EMALLOC(XShmSegmentInfo, 1);
if (pi->shminfo)
{
pi->xim = XShmCreateImage(disp, VRoot.vis, VRoot.depth, ZPixmap, NULL,
@ -85,7 +85,7 @@ ECreatePixImg(Window win, int w, int h)
if (pi->shminfo->shmid >= 0)
{
pi->shminfo->shmaddr = pi->xim->data =
shmat(pi->shminfo->shmid, 0, 0);
(char *)shmat(pi->shminfo->shmid, 0, 0);
if (pi->shminfo->shmaddr)
{
pi->shminfo->readOnly = False;

View File

@ -204,7 +204,7 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
}
else if (prop_ret && type_ret == XA_CARDINAL && format_ret == 32)
{
val = malloc(num_ret * sizeof(unsigned int));
val = (unsigned int *)malloc(num_ret * sizeof(unsigned int));
for (i = 0; i < num_ret; i++)
val[i] = ((unsigned long *)prop_ret)[i];
num = num_ret;
@ -268,7 +268,7 @@ ecore_x_window_prop_string_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
{
if (items > 0)
{
pstr = malloc(items * sizeof(char *));
pstr = (char **)malloc(items * sizeof(char *));
for (i = 0; i < items; i++)
pstr[i] = (list[i] && (*list[i] || i < items - 1)) ?
strdup(list[i]) : NULL;
@ -280,7 +280,7 @@ ecore_x_window_prop_string_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
}
/* Bad format or XmbTextPropertyToTextList failed - Now what? */
pstr = malloc(sizeof(char *));
pstr = (char **)malloc(sizeof(char *));
pstr[0] = (xtp.value) ? strdup((char *)xtp.value) : NULL;
items = 1;
@ -367,7 +367,7 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
&format_ret, &num_ret, &bytes_after, &prop_ret);
if (prop_ret && num_ret > 0 && format_ret == 8)
{
str = malloc(num_ret + 1);
str = (char *)malloc(num_ret + 1);
if (str)
{
memcpy(str, prop_ret, num_ret);
@ -487,7 +487,7 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
}
else if (prop_ret && type_ret == type && format_ret == 32)
{
alst = malloc(num_ret * sizeof(Ecore_X_ID));
alst = (Ecore_X_Atom *) malloc(num_ret * sizeof(Ecore_X_ID));
for (i = 0; i < num_ret; i++)
alst[i] = ((unsigned long *)prop_ret)[i];
*val = alst;
@ -541,7 +541,7 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
goto done;
/* Add it */
num++;
lst = realloc(lst, num * sizeof(Ecore_X_ID));
lst = (Ecore_X_ID *) realloc(lst, num * sizeof(Ecore_X_ID));
lst[i] = item;
}
@ -1088,7 +1088,7 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root, const char **names,
}
l = strlen(s) + 1;
buf = realloc(buf, len + l);
buf = (char *)realloc(buf, len + l);
memcpy(buf + len, s, l);
len += l;
}

View File

@ -959,7 +959,7 @@ ecore_list_node_new(void)
{
Ecore_List_Node *new_node;
new_node = malloc(sizeof(Ecore_List_Node));
new_node = (Ecore_List_Node *) malloc(sizeof(Ecore_List_Node));
if (!ecore_list_node_init(new_node))
{
@ -1019,7 +1019,7 @@ ecore_list_items_get(Ecore_List * list, int *pnum)
if (num <= 0)
return NULL;
lst = malloc(num * sizeof(void *));
lst = (void **)malloc(num * sizeof(void *));
if (!lst)
return NULL;

View File

@ -107,8 +107,13 @@ EAPI int ecore_list_set_free_cb(Ecore_List * list,
#endif /* USE_ECORE */
/* e16 additions */
#if __cplusplus
#define ECORE_LIST_FOR_EACH(list, p) \
for (ecore_list_goto_first(list); (p = (typeof(p))ecore_list_next(list)) != NULL;)
#else
#define ECORE_LIST_FOR_EACH(list, p) \
for (ecore_list_goto_first(list); (p = ecore_list_next(list)) != NULL;)
#endif
EAPI void *ecore_list_remove_node(Ecore_List * list, void *_data);
EAPI void **ecore_list_items_get(Ecore_List * list, int *pnum);

View File

@ -85,7 +85,7 @@
#define INV_GEOM (INV_POS | INV_SIZE)
#define INV_ALL (INV_POS | INV_SIZE | INV_CLIP | INV_OPACITY | INV_SHADOW | INV_PIXMAP)
typedef struct
struct _eoci
{
EObj *next; /* Paint order */
EObj *prev; /* Paint order */
@ -113,7 +113,7 @@ typedef struct
unsigned int opacity;
unsigned long damage_sequence; /* sequence when damage was created */
} ECmWinInfo;
};
/*
* Configuration
@ -412,10 +412,10 @@ EPictureCreateSolid(Bool argb, double a, double r, double g, double b)
pa.repeat = True;
pict = XRenderCreatePicture(dpy, pmap, pictfmt, CPRepeat, &pa);
c.alpha = a * 0xffff;
c.red = r * 0xffff;
c.green = g * 0xffff;
c.blue = b * 0xffff;
c.alpha = (unsigned short)(a * 0xffff);
c.red = (unsigned short)(r * 0xffff);
c.green = (unsigned short)(g * 0xffff);
c.blue = (unsigned short)(b * 0xffff);
XRenderFillRectangle(dpy, PictOpSrc, pict, &c, 0, 0, 1, 1);
XFreePixmap(dpy, pmap);
@ -706,7 +706,8 @@ make_gaussian_map(double r)
double t;
double g;
c = malloc(sizeof(conv) + size * size * sizeof(double));
c = (conv *) EMALLOC(char, sizeof(conv) + size * size * sizeof(double));
c->size = size;
c->data = (double *)(c + 1);
t = 0.0;
@ -811,7 +812,8 @@ make_shadow(double opacity, int width, int height)
unsigned char d;
int x_diff;
data = calloc(swidth * sheight, sizeof(unsigned char));
data = ECALLOC(unsigned char, swidth * sheight);
if (!data)
return NULL;
@ -821,7 +823,7 @@ make_shadow(double opacity, int width, int height)
swidth, sheight, 8, swidth * sizeof(unsigned char));
if (!ximage)
{
free(data);
Efree(data);
return NULL;
}
@ -1220,7 +1222,7 @@ ECompMgrWinFadeCancel(EObj * eo)
static void
doECompMgrWinFade(int val, void *data)
{
EObj *eo = data;
EObj *eo = (EObj *) data;
ECmWinInfo *cw;
unsigned int op = (unsigned int)val;
@ -1441,7 +1443,7 @@ ECompMgrWinNew(EObj * eo)
return;
}
cw = Ecalloc(1, sizeof(ECmWinInfo));
cw = ECALLOC(ECmWinInfo, 1);
if (!cw)
return;
@ -2171,17 +2173,8 @@ ECompMgrRootExpose(void *prm __UNUSED__, XEvent * ev)
if (n_expose == size_expose)
{
if (expose_rects)
{
expose_rects = realloc(expose_rects,
(size_expose + more) * sizeof(XRectangle));
size_expose += more;
}
else
{
expose_rects = malloc(more * sizeof(XRectangle));
size_expose = more;
}
expose_rects = EREALLOC(XRectangle, expose_rects, size_expose + more);
size_expose += more;
}
expose_rects[n_expose].x = ev->xexpose.x;
expose_rects[n_expose].y = ev->xexpose.y;
@ -2214,7 +2207,7 @@ ECompMgrShadowsInit(int mode, int cleanup)
Mode_compmgr.opac_sharp = .01 * Conf_compmgr.shadows.sharp.opacity;
if (gaussianMap)
free(gaussianMap);
Efree(gaussianMap);
gaussianMap = NULL;
if (mode != ECM_SHADOWS_OFF)
@ -2345,7 +2338,7 @@ ECompMgrStop(void)
lst1 = EobjListStackGet(&num);
if (num > 0)
{
lst = Emalloc(num * sizeof(EObj *));
lst = EMALLOC(EObj *, num);
if (lst)
{
memcpy(lst, lst1, num * sizeof(EObj *));
@ -2439,7 +2432,7 @@ ECompMgrConfigSet(const cfg_composite * cfg)
static void
ECompMgrHandleWindowEvent(Win win __UNUSED__, XEvent * ev, void *prm)
{
EObj *eo = prm;
EObj *eo = (EObj *) prm;
D2printf("ECompMgrHandleWindowEvent: type=%d\n", ev->type);
@ -2713,6 +2706,7 @@ static const CfgItem CompMgrCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModCompMgr;
const EModule ModCompMgr = {
"compmgr", "cm",
ECompMgrSighan,

View File

@ -54,7 +54,7 @@ e16_db_open(const char *name)
if (!fs)
return NULL;
ecf = Ecalloc(1, sizeof(ECfgFile));
ecf = ECALLOC(ECfgFile, 1);
if (!ecf)
goto done;
@ -78,7 +78,7 @@ e16_db_open_read(const char *name)
if (!fs)
return NULL;
ecf = Ecalloc(1, sizeof(ECfgFile));
ecf = ECALLOC(ECfgFile, 1);
if (!ecf)
goto done;
@ -101,7 +101,7 @@ e16_db_open_read(const char *name)
continue; /* Ignore bad format */
i = ecf->nitms++;
ecf->pitms = Erealloc(ecf->pitms, ecf->nitms * sizeof(ECfgFileItem));
ecf->pitms = EREALLOC(ECfgFileItem, ecf->pitms, ecf->nitms);
ecf->pitms[i].key = Estrdup(key);
ecf->pitms[i].value = Estrdup(s + len);
}

View File

@ -250,7 +250,7 @@ void
EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
int dx, int dy, int dw, int dh, int ox, int oy)
{
Imlib_Image *tim;
Imlib_Image tim;
int x, y, tx, ty, ww, hh;
int sw, sh;
@ -424,7 +424,7 @@ ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst, Pixmap * pdst,
int sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh, int scale)
{
Imlib_Image *im;
Imlib_Image im;
scale = (scale) ? 2 : 1;
@ -447,7 +447,7 @@ EDrawableDumpImage(Drawable draw, const char *txt)
{
static int seqn = 0;
char buf[1024];
Imlib_Image *im;
Imlib_Image im;
int w, h;
w = h = 0;

View File

@ -27,7 +27,7 @@
void
EModuleRegister(EModule * em)
{
p_modules = Erealloc(p_modules, (n_modules + 1) * sizeof(EModule *));
p_modules = EREALLOC(EModule *, p_modules, n_modules + 1);
p_modules[n_modules++] = em;
}
#endif
@ -182,7 +182,7 @@ ModulesGetCfgItems(const CfgItem *** ppi, int *pni)
if (p_modules[i]->cfg.lst)
{
n = p_modules[i]->cfg.num;
pi = Erealloc(pi, (k + n) * sizeof(CfgItem *));
pi = EREALLOC(CfgItem *, pi, k + n);
for (j = 0; j < n; j++)
pi[k++] = &(p_modules[i]->cfg.lst[j]);
}
@ -205,7 +205,8 @@ ModulesGetIpcItems(const IpcItem *** ppi, int *pni)
if (p_modules[i]->ipc.lst)
{
n = p_modules[i]->ipc.num;
pi = Erealloc(pi, (k + n) * sizeof(IpcItem *));
pi = EREALLOC(const IpcItem *, pi, k + n);
for (j = 0; j < n; j++)
pi[k++] = &(p_modules[i]->ipc.lst[j]);
}

View File

@ -263,7 +263,7 @@ EobjWindowCreate(int type, int x, int y, int w, int h, int su, const char *name)
{
EObj *eo;
eo = Ecalloc(1, sizeof(EObj));
eo = ECALLOC(EObj, 1);
eo->floating = 1;
EobjSetLayer(eo, 20);
@ -304,11 +304,15 @@ EobjRegister(Window xwin, int type)
if (!win)
return NULL;
eo = Ecalloc(1, sizeof(EObj));
eo = ECALLOC(EObj, 1);
if (!eo)
return eo;
#if __cplusplus
if (attr.c_class == InputOnly)
#else
if (attr.class == InputOnly)
#endif
eo->inputonly = 1;
eo->external = 1;
@ -586,7 +590,7 @@ EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed)
if (num <= 0)
return;
xy = Emalloc(sizeof(struct _xy) * num);
xy = EMALLOC(struct _xy, num);
if (!xy)
return;

View File

@ -26,6 +26,10 @@
#include "etypes.h"
#include "xwin.h"
#if USE_COMPOSITE
typedef struct _eoci ECmWinInfo;
#endif
typedef struct _eobj EObj;
struct _eobj
@ -49,7 +53,7 @@ struct _eobj
unsigned argb:1;
#if USE_COMPOSITE
unsigned int opacity;
void *cmhook;
ECmWinInfo *cmhook;
unsigned int serial;
#endif
struct

View File

@ -547,7 +547,7 @@ EventsFetch(XEvent ** evq_p, int *evq_n)
if (count > qsz)
{
qsz = count;
evq = Erealloc(evq, sizeof(XEvent) * qsz);
evq = EREALLOC(XEvent, evq, qsz);
}
ev = evq + i;
for (; i < count; i++, ev++)

View File

@ -180,8 +180,9 @@ SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
if (num_wins <= 0)
return;
x = Emalloc(sizeof(int) * num_wins);
y = Emalloc(sizeof(int) * num_wins);
x = EMALLOC(int, num_wins);
y = EMALLOC(int, num_wins);
if (!x || !y)
goto done;
@ -1359,7 +1360,7 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
int i, num;
const Border *b;
if (ewin->state.fullscreen == on)
if (ewin->state.fullscreen == (unsigned)on)
return;
if (on)

View File

@ -99,7 +99,7 @@ EwinCreate(int type)
{
EWin *ewin;
ewin = Ecalloc(1, sizeof(EWin));
ewin = ECALLOC(EWin, 1);
ewin->type = type;
ewin->state.state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
@ -1819,7 +1819,7 @@ EwinUpdateOpacity(EWin * ewin)
static void
EwinSlideIn(int val __UNUSED__, void *data)
{
EWin *ewin = data;
EWin *ewin = (EWin *) data;
/* May be gone */
if (!EwinFindByPtr(ewin))
@ -2300,7 +2300,7 @@ EwinsSighan(int sig, void *prm)
EwinsTouch(DesksGetCurrent());
break;
case ESIGNAL_BACKGROUND_CHANGE:
EwinsTouch(prm);
EwinsTouch((Desk *) prm);
break;
}
}
@ -2317,6 +2317,7 @@ static const IpcItem EwinsIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModEwins;
const EModule ModEwins = {
"ewins", NULL,
EwinsSighan,

View File

@ -197,7 +197,7 @@ EWMH_SetDesktopRoots(void)
Ecore_X_Window *wl;
n_desks = DesksGetNumber();
wl = Emalloc(n_desks * sizeof(Ecore_X_Window));
wl = EMALLOC(Ecore_X_Window, n_desks);
if (!wl)
return;
@ -233,7 +233,8 @@ EWMH_SetWorkArea(void)
n_desks = DesksGetNumber();
n_coord = 4 * n_desks;
p_coord = Emalloc(n_coord * sizeof(unsigned int));
p_coord = EMALLOC(unsigned int, n_coord);
if (!p_coord)
return;
@ -264,7 +265,8 @@ EWMH_SetDesktopViewport(void)
n_desks = DesksGetNumber();
n_coord = 2 * n_desks;
p_coord = Emalloc(n_coord * sizeof(unsigned int));
p_coord = EMALLOC(unsigned int, n_coord);
if (!p_coord)
return;
@ -301,7 +303,7 @@ EWMH_SetClientList(void)
lst = EwinListOrderGet(&num);
if (num > 0)
{
wl = Emalloc(num * sizeof(Ecore_X_Window));
wl = EMALLOC(Ecore_X_Window, num);
for (i = 0; i < num; i++)
wl[i] = EwinGetClientXwin(lst[i]);
ecore_x_netwm_client_list_set(VRoot.xwin, wl, num);
@ -324,7 +326,7 @@ EWMH_SetClientStacking(void)
lst = EwinListStackGet(&num);
if (num > 0)
{
wl = Emalloc(num * sizeof(Ecore_X_Window));
wl = EMALLOC(Ecore_X_Window, num);
for (i = 0; i < num; i++)
wl[i] = EwinGetClientXwin(lst[num - i - 1]);
ecore_x_netwm_client_list_stacking_set(VRoot.xwin, wl, num);
@ -932,7 +934,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * ev)
* It is assumed(!) that only the MAXIMIZE H/V ones can be set
* in one message.
*/
int action;
unsigned int action;
Atom atom, atom2;
action = ev->data.l[0];
@ -971,7 +973,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * ev)
atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
{
void (*func) (EWin *, const char *);
int maxh, maxv;
unsigned int maxh, maxv;
maxh = ewin->state.maximized_horz;
maxv = ewin->state.maximized_vert;

View File

@ -57,7 +57,7 @@ E_ls(const char *dir, int *num)
*num = dirlen;
return NULL;
}
names = (char **)Emalloc(dirlen * sizeof(char *));
names = EMALLOC(char *, dirlen);
if (!names)
return NULL;
@ -305,7 +305,8 @@ path_test(const char *file, unsigned int test)
len = (ep) ? (unsigned int)(ep - cp) : strlen(cp);
if (len == 0)
continue;
p = Erealloc(s, len + exelen + 2);
p = EREALLOC(char, s, len + exelen + 2);
if (!p)
break;
s = p;

View File

@ -175,7 +175,7 @@ ListWinGroupMembersForEwin(const EWin * ewin, int action, char nogroup,
}
do_add:
gwins = Erealloc(gwins, (gwcnt + 1) * sizeof(EWin *));
gwins = EREALLOC(EWin *, gwins, gwcnt + 1);
gwins[gwcnt] = ew;
gwcnt++;
}
@ -183,7 +183,7 @@ ListWinGroupMembersForEwin(const EWin * ewin, int action, char nogroup,
done:
if (gwins == NULL)
{
gwins = Emalloc(sizeof(EWin *));
gwins = EMALLOC(EWin *, 1);
gwins[0] = (EWin *) ewin;
gwcnt = 1;
}
@ -216,7 +216,7 @@ EwinListTransients(const EWin * ewin, int *num, int group)
if (EwinGetTransientFor(ew) == EwinGetClientXwin(ewin))
{
lst = Erealloc(lst, (j + 1) * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, j + 1);
lst[j++] = ew;
}
}
@ -239,7 +239,7 @@ EwinListTransients(const EWin * ewin, int *num, int group)
if (EwinGetTransientFor(ew) == VRoot.xwin &&
EwinGetWindowGroup(ew) == EwinGetWindowGroup(ewin))
{
lst = Erealloc(lst, (j + 1) * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, j + 1);
lst[j++] = ew;
}
}
@ -276,7 +276,7 @@ EwinListTransientFor(const EWin * ewin, int *num)
EwinGetTransientFor(ewin) == VRoot.xwin &&
EwinGetWindowGroup(ew) == EwinGetWindowGroup(ewin)))
{
lst = Erealloc(lst, (j + 1) * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, j + 1);
lst[j++] = ew;
}
}

View File

@ -30,6 +30,7 @@
#include "focus.h"
#include "grabs.h"
#include "hints.h"
#include "settings.h"
#include "timers.h"
#include "xwin.h"
@ -245,7 +246,7 @@ FocusEwinSetGrabs(EWin * ewin)
static void
FocusEwinSetActive(EWin * ewin, int active)
{
if (ewin->state.active == active)
if (ewin->state.active == (unsigned)active)
return;
ewin->state.active = active;
@ -1017,6 +1018,7 @@ static const CfgItem FocusCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModFocus;
const EModule ModFocus = {
"focus", NULL,
FocusSighan,

View File

@ -34,7 +34,7 @@ static Ecore_List *font_list = NULL;
static void
_FontAliasDestroy(void *data)
{
FontAlias *fa = data;
FontAlias *fa = (FontAlias *) data;
if (!fa)
return;
@ -48,7 +48,7 @@ FontAliasCreate(const char *name, const char *font)
{
FontAlias *fa;
fa = Emalloc(sizeof(FontAlias));
fa = EMALLOC(FontAlias, 1);
if (!fa)
return NULL;
@ -68,7 +68,7 @@ FontAliasCreate(const char *name, const char *font)
static int
_FontMatchName(const void *data, const void *match)
{
return strcmp(((const FontAlias *)data)->name, match);
return strcmp(((const FontAlias *)data)->name, (const char *)match);
}
const char *
@ -76,7 +76,7 @@ FontLookup(const char *name)
{
FontAlias *fa;
fa = ecore_list_find(font_list, _FontMatchName, name);
fa = (FontAlias *) ecore_list_find(font_list, _FontMatchName, name);
return (fa) ? fa->font : NULL;
}

View File

@ -26,6 +26,7 @@
#include "eimage.h"
#include "emodule.h"
#include "parse.h"
#include "settings.h"
#include "timers.h"
#include "xwin.h"
#include <math.h>
@ -985,6 +986,7 @@ static const CfgItem FxCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModEffects;
const EModule ModEffects = {
"effects", "efx",
FxSighan,

View File

@ -630,7 +630,8 @@ GNOME_SetDeskNames(void)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False);
n_desks = DesksGetNumber();
names = Emalloc(n_desks * sizeof(char *));
names = EMALLOC(char *, n_desks);
if (!names)
return;
@ -664,7 +665,8 @@ GNOME_SetClientList(void)
j = 0;
if (lst)
{
wl = Emalloc(num * sizeof(unsigned int));
wl = EMALLOC(unsigned int, num);
for (i = 0; i < num; i++)
{
if (!lst[i]->props.skip_ext_task && !EwinIsTransientChild(lst[i]))

View File

@ -29,6 +29,7 @@
#include "ewins.h"
#include "groups.h"
#include "parse.h"
#include "settings.h"
#include "snaps.h"
#include "timers.h"
#include <math.h>
@ -64,7 +65,7 @@ GroupCreate(void)
Group *g;
double t;
g = Emalloc(sizeof(Group));
g = EMALLOC(Group, 1);
if (!g)
return NULL;
@ -114,7 +115,8 @@ GroupMatchId(const void *data, const void *match)
Group *
GroupFind(int gid)
{
return ecore_list_find(group_list, GroupMatchId, (void *)(long)gid);
return (Group *) ecore_list_find(group_list, GroupMatchId,
(void *)(long)gid);
}
void
@ -188,7 +190,7 @@ ListWinGroups(const EWin * ewin, char group_select, int *num)
switch (group_select)
{
case GROUP_SELECT_EWIN_ONLY:
groups = (Group **) Emalloc(sizeof(Group *) * ewin->num_groups);
groups = EMALLOC(Group *, ewin->num_groups);
if (!groups)
break;
memcpy(groups, ewin->groups, sizeof(Group *) * ewin->num_groups);
@ -210,7 +212,7 @@ ListWinGroups(const EWin * ewin, char group_select, int *num)
}
}
}
groups = (Group **) Emalloc(sizeof(Group *) * (*num - killed));
groups = EMALLOC(Group *, *num - killed);
if (groups)
{
j = 0;
@ -241,11 +243,10 @@ AddEwinToGroup(EWin * ewin, Group * g)
if (ewin->groups[i] == g)
return;
ewin->num_groups++;
ewin->groups =
Erealloc(ewin->groups, sizeof(Group *) * ewin->num_groups);
ewin->groups = EREALLOC(Group *, ewin->groups, ewin->num_groups);
ewin->groups[ewin->num_groups - 1] = g;
g->num_members++;
g->members = Erealloc(g->members, sizeof(EWin *) * g->num_members);
g->members = EREALLOC(EWin *, g->members, g->num_members);
g->members[g->num_members - 1] = ewin;
SnapshotEwinUpdate(ewin, SNAP_USE_GROUPS);
}
@ -307,8 +308,7 @@ RemoveEwinFromGroup(EWin * ewin, Group * g)
g->members[j] = g->members[j + 1];
g->num_members--;
if (g->num_members > 0)
g->members =
Erealloc(g->members, sizeof(EWin *) * g->num_members);
g->members = EREALLOC(EWin *, g->members, g->num_members);
else
{
GroupDestroy(g);
@ -326,7 +326,7 @@ RemoveEwinFromGroup(EWin * ewin, Group * g)
}
else
ewin->groups =
Erealloc(ewin->groups, sizeof(Group *) * ewin->num_groups);
EREALLOC(Group *, ewin->groups, ewin->num_groups);
SaveGroups();
return;
@ -350,13 +350,15 @@ GetWinGroupMemberNames(Group ** groups, int num)
int i, j;
char **group_member_strings;
group_member_strings = Ecalloc(num, sizeof(char *));
group_member_strings = ECALLOC(char *, num);
if (!group_member_strings)
return NULL;
for (i = 0; i < num; i++)
{
group_member_strings[i] = Emalloc(sizeof(char) * 1024);
group_member_strings[i] = EMALLOC(char, 1024);
if (!group_member_strings[i])
break;
@ -632,7 +634,7 @@ _DlgFillGroupChoose(Dialog * d, DItem * table, void *data)
DItem *di, *radio;
int i, num_groups;
char **group_member_strings;
const char *message = data;
const char *message = (const char *)data;
DialogItemTableSetOptions(table, 2, 0, 0, 0);
@ -734,7 +736,7 @@ typedef struct
static void
CB_ConfigureGroup(Dialog * d, int val, void *data __UNUSED__)
{
EwinGroupDlgData *dd = DialogGetData(d);
EwinGroupDlgData *dd = (EwinGroupDlgData *) DialogGetData(d);
EWin *ewin;
int i;
@ -765,7 +767,7 @@ CB_ConfigureGroup(Dialog * d, int val, void *data __UNUSED__)
static void
GroupSelectCallback(Dialog * d, int val, void *data __UNUSED__)
{
EwinGroupDlgData *dd = DialogGetData(d);
EwinGroupDlgData *dd = (EwinGroupDlgData *) DialogGetData(d);
CopyGroupConfig(&(dd->cfg), &(dd->cfgs[dd->current]));
CopyGroupConfig(&(dd->cfgs[val]), &(dd->cfg));
@ -778,18 +780,18 @@ GroupSelectCallback(Dialog * d, int val, void *data __UNUSED__)
static void
_DlgFillGroups(Dialog * d, DItem * table, void *data)
{
EWin *ewin = data;
EWin *ewin = (EWin *) data;
DItem *radio, *di;
int i;
char **group_member_strings;
EwinGroupDlgData *dd;
dd = Ecalloc(1, sizeof(EwinGroupDlgData));
dd = ECALLOC(EwinGroupDlgData, 1);
if (!dd)
return;
dd->ewin = ewin;
dd->cfgs = Emalloc(ewin->num_groups * sizeof(GroupConfig));
dd->cfgs = EMALLOC(GroupConfig, ewin->num_groups);
dd->ngrp = ewin->num_groups;
dd->current = 0;
for (i = 0; i < ewin->num_groups; i++)
@ -1465,6 +1467,7 @@ static const CfgItem GroupsCfgItems[] = {
};
#define N_CFG_ITEMS (sizeof(GroupsCfgItems)/sizeof(CfgItem))
extern const EModule ModGroups;
const EModule ModGroups = {
"groups", "grp",
GroupsSighan,

View File

@ -423,7 +423,7 @@ EHintsSetDeskInfo(void)
if (n_desks <= 0)
return;
c = Emalloc(2 * n_desks * sizeof(unsigned int));
c = EMALLOC(unsigned int, 2 * n_desks);
if (!c)
return;
@ -456,7 +456,8 @@ EHintsGetDeskInfo(void)
int num, i, n_desks;
n_desks = DesksGetNumber();
c = Emalloc(2 * n_desks * sizeof(unsigned int));
c = EMALLOC(unsigned int, 2 * n_desks);
if (!c)
return;
@ -519,7 +520,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data)
ESelection *sel;
char buf[128];
sel = Ecalloc(1, sizeof(ESelection));
sel = ECALLOC(ESelection, 1);
if (!sel)
return sel;

View File

@ -233,7 +233,7 @@ static const HiwinRender HiwinRenderPixmap = {
static void
HiwinEvent(Win win, XEvent * ev, void *prm)
{
Hiwin *phi = prm;
Hiwin *phi = (Hiwin *) prm;
if (phi->evcb)
phi->evcb(win, ev, phi->data);
@ -243,7 +243,7 @@ HiwinEvent(Win win, XEvent * ev, void *prm)
static void
HiwinEwinEvent(Win win __UNUSED__, XEvent * ev, void *prm)
{
Hiwin *phi = prm;
Hiwin *phi = (Hiwin *) prm;
#if DEBUG_HIWIN
Eprintf("HiwinEwinEvent type=%d %s\n", ev->type, EwinGetTitle(phi->ewin));
@ -263,7 +263,7 @@ HiwinCreate(void)
{
Hiwin *phi;
phi = Ecalloc(1, sizeof(Hiwin));
phi = ECALLOC(Hiwin, 1);
if (!phi)
return NULL;

View File

@ -199,7 +199,7 @@ ImagestateCreate(void)
{
ImageState *is;
is = Emalloc(sizeof(ImageState));
is = EMALLOC(ImageState, 1);
if (!is)
return NULL;
@ -317,7 +317,7 @@ ImageclassCreate(const char *name)
{
ImageClass *ic;
ic = Ecalloc(1, sizeof(ImageClass));
ic = ECALLOC(ImageClass, 1);
if (!ic)
return NULL;
@ -402,7 +402,7 @@ ImageclassGetPadding(ImageClass * ic)
static int
_ImageclassMatchName(const void *data, const void *match)
{
return strcmp(((const ImageClass *)data)->name, match);
return strcmp(((const ImageClass *)data)->name, (const char *)match);
}
ImageClass *
@ -412,12 +412,16 @@ ImageclassFind(const char *name, int fallback)
if (name)
{
ic = ecore_list_find(iclass_list, _ImageclassMatchName, name);
ic =
(ImageClass *) ecore_list_find(iclass_list, _ImageclassMatchName,
name);
if (ic || !fallback)
return ic;
}
ic = ecore_list_find(iclass_list, _ImageclassMatchName, "__FALLBACK_ICLASS");
ic =
(ImageClass *) ecore_list_find(iclass_list, _ImageclassMatchName,
"__FALLBACK_ICLASS");
return ic;
}
@ -557,7 +561,7 @@ ImageclassConfigLoad(FILE * fs)
goto done;
case ICLASS_LRTB:
{
ICToRead->border = Emalloc(sizeof(EImageBorder));
ICToRead->border = EMALLOC(EImageBorder, 1);
l = r = t = b = 0;
sscanf(s, "%*s %i %i %i %i", &l, &r, &t, &b);
@ -1649,6 +1653,7 @@ static const IpcItem ImageclassIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModImageclass;
const EModule ModImageclass = {
"imageclass", "ic",
ImageclassSighan,

View File

@ -115,24 +115,24 @@ IB_Animate_A(char iconify, EWin * ewin, EWin * ibox)
{
aa = 1.0 - a;
x = (fx * aa) + (tx * a);
y = (fy * aa) + (ty * a);
w = (fw * aa) + (tw * a);
h = (fh * aa) + (th * a);
x = (int)((fx * aa) + (tx * a));
y = (int)((fy * aa) + (ty * a));
w = (int)((fw * aa) + (tw * a));
h = (int)((fh * aa) + (th * a));
x = (2 * x + w) / 2; /* x middle */
y = (2 * y + h) / 2; /* y middle */
w /= 2; /* width/2 */
h /= 2; /* height/2 */
x1 = x + w * (1 - .5 * sin(3.14159 + a * 6.2831853072));
y1 = y + h * cos(a * 6.2831853072);
x2 = x + w * (1 - .5 * sin(a * 6.2831853072));
y2 = y - h * cos(a * 6.2831853072);
x3 = x - w * (1 - .5 * sin(3.14159 + a * 6.2831853072));
y3 = y - h * cos(a * 6.2831853072);
x4 = x - w * (1 - .5 * sin(a * 6.2831853072));
y4 = y + h * cos(a * 6.2831853072);
x1 = (int)(x + w * (1 - .5 * sin(3.14159 + a * 6.2831853072)));
y1 = (int)(y + h * cos(a * 6.2831853072));
x2 = (int)(x + w * (1 - .5 * sin(a * 6.2831853072)));
y2 = (int)(y - h * cos(a * 6.2831853072));
x3 = (int)(x - w * (1 - .5 * sin(3.14159 + a * 6.2831853072)));
y3 = (int)(y - h * cos(a * 6.2831853072));
x4 = (int)(x - w * (1 - .5 * sin(a * 6.2831853072)));
y4 = (int)(y + h * cos(a * 6.2831853072));
XDrawLine(disp, root, gc, x1, y1, x2, y2);
XDrawLine(disp, root, gc, x2, y2, x3, y3);
@ -210,10 +210,10 @@ IB_Animate_B(char iconify, EWin * ewin, EWin * ibox)
t0 = GetTime();
for (a = 0.0; a < 1.0; a += spd)
{
x = fx + a * (tx - fx);
w = fw + a * (tw - fw);
y = fy + a * (ty - fy);
h = fh + a * (th - fh);
x = (int)(fx + a * (tx - fx));
w = (int)(fw + a * (tw - fw));
y = (int)(fy + a * (ty - fy));
h = (int)(fh + a * (th - fh));
XDrawRectangle(disp, root, gc, x, y, w, h);
ESync();
@ -347,7 +347,7 @@ RemoveMiniIcon(EWin * ewin)
static int
IconboxFindEwin(Container * ct, void *data)
{
EWin *ewin = data;
EWin *ewin = (EWin *) data;
return IconboxObjEwinFind(ct, ewin) >= 0;
@ -481,8 +481,8 @@ IconboxExit(Container * ct, int wm_exit)
while (ct->num_objs)
{
if (!wm_exit)
EwinDeIconify(ct->objs[0].obj);
IconboxObjEwinDel(ct, ct->objs[0].obj);
EwinDeIconify((EWin *) ct->objs[0].obj);
IconboxObjEwinDel(ct, (EWin *) ct->objs[0].obj);
}
}
@ -535,7 +535,8 @@ IconboxEvent(Container * ct, XEvent * ev)
break;
ct->icon_clicked = 0;
ewin = ContainerObjectFindByXY(ct, ev->xbutton.x, ev->xbutton.y);
ewin =
(EWin *) ContainerObjectFindByXY(ct, ev->xbutton.x, ev->xbutton.y);
if (!ewin)
break;
@ -560,7 +561,7 @@ IconboxEvent(Container * ct, XEvent * ev)
if (!ct->shownames)
break;
ewin = ContainerObjectFindByXY(ct, x, y);
ewin = (EWin *) ContainerObjectFindByXY(ct, x, y);
if (ewin == name_ewin)
break;
name_ewin = ewin;
@ -611,6 +612,7 @@ IconboxObjPlace(Container * ct __UNUSED__, ContainerObject * cto, EImage * im)
cto->xi, cto->yi, cto->wi, cto->hi, 1, 1);
}
extern const ContainerOps IconboxOps;
const ContainerOps IconboxOps = {
IconboxInit,
IconboxExit,

View File

@ -87,7 +87,8 @@ IpcPrintf(const char *fmt, ...)
len = Evsnprintf(tmp, sizeof(tmp), fmt, args);
va_end(args);
bufptr = Erealloc(bufptr, bufsiz + len + 1);
bufptr = EREALLOC(char, bufptr, bufsiz + len + 1);
strcpy(bufptr + bufsiz, tmp);
bufsiz += len;
}
@ -185,7 +186,7 @@ IpcFindEwins(const char *match, int *pnum, int *pflags)
continue;
}
nfound++;
lst = Erealloc(lst, nfound * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, nfound);
lst[nfound - 1] = ewin;
if (match_one)
break;
@ -196,7 +197,7 @@ IpcFindEwins(const char *match, int *pnum, int *pflags)
if (!ewin)
return NULL;
nfound = 1;
lst = Emalloc(sizeof(EWin *));
lst = EMALLOC(EWin *, 1);
if (!lst)
return NULL;
lst[0] = ewin;
@ -225,25 +226,25 @@ IpcFindEwin(const char *match)
static int
SetEwinBoolean(const char *txt, char *item, const char *value, int set)
{
int old, new;
int vold, vnew;
new = old = *item != 0; /* Remember old value */
vnew = vold = *item != 0; /* Remember old value */
if (value == NULL || value[0] == '\0')
new = !old;
vnew = !vold;
else if (!strcmp(value, "on"))
new = 1;
vnew = 1;
else if (!strcmp(value, "off"))
new = 0;
vnew = 0;
else if (!strcmp(value, "?"))
IpcPrintf("%s: %s", txt, (old) ? "on" : "off");
IpcPrintf("%s: %s", txt, (vold) ? "on" : "off");
else
IpcPrintf("Error: %s", value);
if (new != old)
if (vnew != vold)
{
if (set)
*item = new;
*item = vnew;
return 1;
}
@ -1557,7 +1558,8 @@ IPC_GetList(int *pnum)
}
num = sizeof(IPCArray) / sizeof(IpcItem);
lst = (const IpcItem **)Emalloc(num * sizeof(IpcItem *));
lst = EMALLOC(const IpcItem *, num);
for (i = 0; i < num; i++)
lst[i] = &IPCArray[i];
@ -1636,11 +1638,11 @@ doEFuncDeferred(int val __UNUSED__, void *data)
void **prm = (void **)data;
EWin *ewin;
ewin = prm[0];
ewin = (EWin *) prm[0];
if (ewin && !EwinFindByPtr(ewin))
return;
EFunc(ewin, prm[1]);
EFunc(ewin, (const char *)prm[1]);
Efree(prm[1]);
Efree(data);
@ -1653,7 +1655,8 @@ EFuncDefer(EWin * ewin, const char *cmd)
char s[32];
void **prm;
prm = Emalloc(2 * sizeof(void *));
prm = EMALLOC(void *, 2);
if (!prm)
return;
prm[0] = ewin;

View File

@ -433,6 +433,7 @@ static const CfgItem LocaleCfgItems[] = {
};
#define N_CFG_ITEMS (sizeof(LocaleCfgItems)/sizeof(CfgItem))
extern const EModule ModLocale;
const EModule ModLocale = {
"locale", NULL,
NULL,

View File

@ -55,7 +55,7 @@ Estrdup(const char *s)
if (!s)
return NULL;
sz = strlen(s);
ss = Emalloc(sz + 1);
ss = EMALLOC(char, sz + 1);
strncpy(ss, s, sz + 1);
return ss;
#endif
@ -73,7 +73,7 @@ Estrndup(const char *s, size_t n)
if (!s)
return NULL;
ss = Emalloc(n + 1);
ss = EMALLOC(char, n + 1);
strncpy(ss, s, n);
ss[n] = '\0';
return ss;
@ -93,7 +93,7 @@ Estrdupcat2(char *ss, const char *s1, const char *s2)
l1 = (s1) ? strlen(s1) : 0;
l2 = (s2) ? strlen(s2) : 0;
s = Erealloc(ss, len + l1 + l2 + 1);
s = EREALLOC(char, ss, len + l1 + l2 + 1);
if (!s)
return NULL;
if (s1 && l1)
@ -115,7 +115,7 @@ StrlistDup(char **lst, int num)
if (!lst || num <= 0)
return NULL;
ss = (char **)Emalloc((num + 1) * sizeof(char *));
ss = EMALLOC(char *, num + 1);
for (i = 0; i < num; i++)
ss[i] = Estrdup(lst[i]);
ss[i] = NULL;
@ -148,12 +148,13 @@ StrlistJoin(char **lst, int num)
s = NULL;
size = strlen(lst[0]) + 1;
s = Emalloc(size);
s = EMALLOC(char, size);
strcpy(s, lst[0]);
for (i = 1; i < num; i++)
{
size += strlen(lst[i]) + 1;
s = Erealloc(s, size);
s = EREALLOC(char, s, size);
strcat(s, " ");
strcat(s, lst[i]);
}
@ -226,7 +227,8 @@ StrlistDecodeEscaped(const char *str, int *pnum)
if (*s == '\0')
break;
lst = Erealloc(lst, (num + 1) * sizeof(char *));
lst = EREALLOC(char *, lst, num + 1);
lst[num] = NULL;
len = 0;
@ -236,7 +238,8 @@ StrlistDecodeEscaped(const char *str, int *pnum)
if (!p)
p = s + strlen(s);
lst[num] = Erealloc(lst[num], len + p - s + 1);
lst[num] = EREALLOC(char, lst[num], len + p - s + 1);
memcpy(lst[num] + len, s, p - s);
len += p - s;
lst[num][len] = '\0';
@ -262,7 +265,8 @@ StrlistDecodeEscaped(const char *str, int *pnum)
}
/* Append NULL item */
lst = Erealloc(lst, (num + 1) * sizeof(char *));
lst = EREALLOC(char *, lst, num + 1);
lst[num] = NULL;
*pnum = num;
@ -293,7 +297,8 @@ StrlistFromString(const char *str, int delim, int *num)
if (len <= 0)
continue;
lst = Erealloc(lst, (n + 2) * sizeof(char *));
lst = EREALLOC(char *, lst, n + 2);
lst[n++] = Estrndup(s, len);
}

View File

@ -589,7 +589,7 @@ static int
BorderNameCompare(void *b1, void *b2)
{
if (b1 && b2)
return strcmp(BorderGetName(b1), BorderGetName(b2));
return strcmp(BorderGetName((Border *) b1), BorderGetName((Border *) b2));
return 0;
}

View File

@ -37,6 +37,7 @@
#include "menus.h"
#include "parse.h"
#include "screen.h"
#include "settings.h"
#include "tclass.h"
#include "timers.h"
#include "tooltips.h"
@ -75,7 +76,7 @@ struct _menuitem
Menu *menu;
ImageClass *icon_iclass;
char *text;
void *params;
char *params;
Menu *child;
char state;
PmapMask pmm[3];
@ -197,7 +198,7 @@ MenuHide(Menu * m)
static void
MenuEwinMoveResize(EWin * ewin, int resize __UNUSED__)
{
Menu *m = ewin->data;
Menu *m = (Menu *) ewin->data;
if (!m)
return;
@ -387,7 +388,7 @@ MenuStyleCreate(const char *name)
{
MenuStyle *ms;
ms = Ecalloc(1, sizeof(MenuStyle));
ms = ECALLOC(MenuStyle, 1);
if (!ms)
return NULL;
@ -407,7 +408,7 @@ MenuItemCreate(const char *text, ImageClass * iclass,
{
MenuItem *mi;
mi = Ecalloc(1, sizeof(MenuItem));
mi = ECALLOC(MenuItem, 1);
mi->icon_iclass = iclass;
if (iclass)
@ -424,13 +425,14 @@ MenuItemCreate(const char *text, ImageClass * iclass,
static int
_MenuStyleMatchName(const void *data, const void *match)
{
return strcmp(((const MenuStyle *)data)->name, match);
return strcmp(((const MenuStyle *)data)->name, (const char *)match);
}
MenuStyle *
MenuStyleFind(const char *name)
{
return ecore_list_find(menu_style_list, _MenuStyleMatchName, name);
return (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
name);
}
void
@ -504,7 +506,7 @@ MenuGetName(const Menu * m)
const char *
MenuGetData(const Menu * m)
{
return m->data;
return (const char *)m->data;
}
time_t
@ -532,7 +534,7 @@ MenuCreate(const char *name, const char *title, Menu * parent, MenuStyle * ms)
{
Menu *m;
m = Ecalloc(1, sizeof(Menu));
m = ECALLOC(Menu, 1);
if (!m)
return m;
@ -551,7 +553,7 @@ MenuDestroy(Menu * m)
if (!m)
return;
m = ecore_list_remove_node(menu_list, m);
m = (Menu *) ecore_list_remove_node(menu_list, m);
if (!m)
return;
@ -635,7 +637,7 @@ void
MenuAddItem(Menu * m, MenuItem * item)
{
m->num++;
m->items = Erealloc(m->items, sizeof(MenuItem *) * m->num);
m->items = EREALLOC(MenuItem *, m->items, m->num);
m->items[m->num - 1] = item;
}
@ -1031,10 +1033,10 @@ MenusDestroyLoaded(void)
static int
_MenuMatchName(const void *data, const void *match)
{
const Menu *m = data;
const Menu *m = (const Menu *)data;
if ((m->name && !strcmp(match, m->name)) ||
(m->alias && !strcmp(match, m->alias)))
if ((m->name && !strcmp((const char *)match, m->name)) ||
(m->alias && !strcmp((const char *)match, m->alias)))
return 0;
return 1;
@ -1045,7 +1047,7 @@ MenuFind(const char *name)
{
Menu *m;
m = ecore_list_find(menu_list, _MenuMatchName, name);
m = (Menu *) ecore_list_find(menu_list, _MenuMatchName, name);
if (m)
return (m);
@ -2127,6 +2129,7 @@ static const CfgItem MenusCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModMenus;
const EModule ModMenus = {
"menus", "menu",
MenusSighan,

View File

@ -179,7 +179,7 @@ ETimedLoopNext(void)
EobjsRepaint();
return y;
return (int)y;
}
/*

View File

@ -25,6 +25,7 @@
#include "dialog.h"
#include "emodule.h"
#include "iclass.h"
#include "settings.h"
#include "timers.h"
#ifdef ENABLE_THEME_TRANSPARENCY
@ -321,6 +322,7 @@ static const CfgItem TransCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModTransparency;
const EModule ModTransparency = {
"transparency", "tr",
TransparencySighan,

View File

@ -35,6 +35,7 @@
#include "hiwin.h"
#include "iclass.h"
#include "menus.h"
#include "settings.h"
#include "timers.h"
#include "tooltips.h"
#include "xwin.h"
@ -136,7 +137,7 @@ PagerCreate(void)
if (!Conf_pagers.enable)
return NULL;
p = Ecalloc(1, sizeof(Pager));
p = ECALLOC(Pager, 1);
if (!p)
return NULL;
@ -642,7 +643,7 @@ PagerUpdateBg(Pager * p)
static void
PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
{
Pager *p = ewin->data;
Pager *p = (Pager *) ewin->data;
int w, h;
int ax, ay, cx, cy;
ImageClass *ic;
@ -686,7 +687,7 @@ PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
static void
PagerEwinClose(EWin * ewin)
{
PagerDestroy(ewin->data);
PagerDestroy((Pager *) ewin->data);
ewin->client.win = NULL;
ewin->data = NULL;
}
@ -782,7 +783,7 @@ PagersForeach(Desk * dsk, void (*func) (Pager * p, void *prm), void *prm)
return;
/* We may get here recursively */
p_cur = ecore_list_current(pager_list);
p_cur = (Pager *) ecore_list_current(pager_list);
ECORE_LIST_FOR_EACH(pager_list, p)
{
@ -802,7 +803,7 @@ typedef struct
static void
_PagerUpdate(Pager * p, void *prm)
{
pager_update_data *pud = prm;
pager_update_data *pud = (pager_update_data *) prm;
PagerUpdate(p, pud->x1, pud->y1, pud->x2, pud->y2);
}
@ -1314,8 +1315,8 @@ PagerEwinGroupSet(void)
if (!gwins)
return;
gwin_px = Emalloc(num * sizeof(int));
gwin_py = Emalloc(num * sizeof(int));
gwin_px = EMALLOC(int, num);
gwin_py = EMALLOC(int, num);
for (i = 0; i < num; i++)
{
@ -1495,7 +1496,7 @@ PagerHiwinHandleMouseUp(Pager * p, int px, int py, int button)
ewin2 = GetEwinPointerInClient();
if ((ewin2) && (ewin2->type == EWIN_TYPE_PAGER))
{
PagerEwinMove(p, ewin2->data, ewin);
PagerEwinMove(p, (Pager *) ewin2->data, ewin);
}
else if ((ewin2) && (ewin2->type == EWIN_TYPE_ICONBOX))
{
@ -1587,7 +1588,7 @@ PagerEvent(Win win __UNUSED__, XEvent * ev, void *prm)
static void
PagerHiwinEvent(Win win, XEvent * ev, void *prm)
{
Pager *p = prm;
Pager *p = (Pager *) prm;
int px, py;
EWin *ewin;
@ -2018,10 +2019,10 @@ PagersSighan(int sig, void *prm)
case ESIGNAL_DESK_ADDED:
if (Mode.wm.startup)
break;
NewPagerForDesktop(prm);
NewPagerForDesktop((Desk *) prm);
break;
case ESIGNAL_DESK_REMOVED:
PagersForDesktopDisable(prm);
PagersForDesktopDisable((Desk *) prm);
break;
case ESIGNAL_DESK_SWITCH_START:
PagerHiwinHide();
@ -2034,14 +2035,14 @@ PagersSighan(int sig, void *prm)
break;
case ESIGNAL_BACKGROUND_CHANGE:
PagersUpdateBackground(prm);
PagersUpdateBackground((Desk *) prm);
break;
case ESIGNAL_EWIN_UNMAP:
PagersUpdateEwin(prm, 1);
PagersUpdateEwin((EWin *) prm, 1);
break;
case ESIGNAL_EWIN_CHANGE:
PagersUpdateEwin(prm, 0);
PagersUpdateEwin((EWin *) prm, 0);
break;
}
}
@ -2158,6 +2159,7 @@ static const CfgItem PagersCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModPagers;
const EModule ModPagers = {
"pagers", "pg",
PagersSighan,

View File

@ -48,9 +48,9 @@ ProgressbarCreate(const char *name, int w, int h)
int x, y, tw, th;
EImageBorder *pad;
p = Ecalloc(1, sizeof(Progressbar));
p = ECALLOC(Progressbar, 1);
pnum++;
plist = Erealloc(plist, pnum * sizeof(Progressbar *));
plist = EREALLOC(Progressbar *, plist, pnum);
plist[pnum - 1] = p;
p->ic = ImageclassFind("PROGRESS_BAR", 1);
@ -142,7 +142,7 @@ ProgressbarDestroy(Progressbar * p)
}
else
{
plist = Erealloc(plist, pnum * sizeof(Progressbar *));
plist = EREALLOC(Progressbar *, plist, pnum);
}
}

View File

@ -46,7 +46,7 @@ ScreenAdd(int type, int head, int x, int y, unsigned int w, unsigned int h)
EScreen *es;
n_screens++;
p_screens = Erealloc(p_screens, n_screens * sizeof(EScreen));
p_screens = EREALLOC(EScreen, p_screens, n_screens);
es = p_screens + n_screens - 1;
es->type = type;

View File

@ -27,6 +27,7 @@
#include "emodule.h"
#include "ewins.h"
#include "session.h"
#include "settings.h"
#include "snaps.h"
#include "user.h"
#include "xwin.h"
@ -221,7 +222,7 @@ set_save_props(SmcConn smc_conn, int master_flag)
restartVal[n++].value = (char *)s;
for (i = 0; i < n; i++)
restartVal[i].length = strlen(restartVal[i].value);
restartVal[i].length = strlen((const char *)restartVal[i].value);
restartProp.num_vals = n;

View File

@ -534,7 +534,7 @@ CB_ConfigureComposite(Dialog * d, int val, void *data __UNUSED__)
return;
/* Configure and read back */
cfg = DialogGetData(d);
cfg = (cfg_composite *) DialogGetData(d);
ECompMgrConfigSet(cfg);
ECompMgrConfigGet(cfg);
}
@ -657,7 +657,7 @@ static void
CB_DlgSelect(Dialog * d, int val, void *data)
{
const DialogDef *dd = dialogs[val];
DItem *table = data;
DItem *table = (DItem *) data;
if (!table)
return;

View File

@ -168,8 +168,7 @@ SetupX(const char *dstr)
/* We are the master */
Mode.wm.child_count++;
Mode.wm.children =
Erealloc(Mode.wm.children,
sizeof(pid_t) * Mode.wm.child_count);
EREALLOC(pid_t, Mode.wm.children, Mode.wm.child_count);
Mode.wm.children[Mode.wm.child_count - 1] = pid;
}
else

View File

@ -68,7 +68,7 @@ SlideoutCreate(const char *name, char dir)
{
Slideout *s;
s = Ecalloc(1, sizeof(Slideout));
s = ECALLOC(Slideout, 1);
if (!s)
return NULL;
@ -343,7 +343,7 @@ SlideoutAddButton(Slideout * s, Button * b)
return;
s->num_objs++;
s->objs = Erealloc(s->objs, sizeof(EObj *) * s->num_objs);
s->objs = EREALLOC(EObj *, s->objs, s->num_objs);
s->objs[s->num_objs - 1] = eob;
ButtonSwallowInto(b, EoObj(s));
ButtonSetCallback(b, SlideoutButtonCallback, EoObj(s));
@ -362,7 +362,7 @@ SlideoutRemoveButton(Slideout * s, Button * b)
static void
SlideoutHandleEvent(Win win __UNUSED__, XEvent * ev, void *prm)
{
Slideout *s = prm;
Slideout *s = (Slideout *) prm;
switch (ev->type)
{
@ -491,13 +491,13 @@ SlideoutsSighan(int sig, void *prm)
static int
_SlideoutMatchName(const void *data, const void *match)
{
return strcmp(((const Slideout *)data)->name, match);
return strcmp(((const Slideout *)data)->name, (const char *)match);
}
static Slideout *
SlideoutFind(const char *name)
{
return ecore_list_find(slideout_list, _SlideoutMatchName, name);
return (Slideout *) ecore_list_find(slideout_list, _SlideoutMatchName, name);
}
static void
@ -525,6 +525,7 @@ static const IpcItem SlideoutsIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModSlideouts;
const EModule ModSlideouts = {
"slideouts", "slideout",
SlideoutsSighan,

View File

@ -30,6 +30,7 @@
#include "file.h"
#include "groups.h"
#include "parse.h"
#include "settings.h"
#include "snaps.h"
#include "timers.h"
#include "xwin.h"
@ -77,7 +78,7 @@ SnapshotCreate(const char *name)
{
Snapshot *sn;
sn = Ecalloc(1, sizeof(Snapshot));
sn = ECALLOC(Snapshot, 1);
if (!sn)
return NULL;
@ -94,7 +95,7 @@ static void
SnapshotDestroy(Snapshot * sn)
{
/* Just making sure */
sn = ecore_list_remove_node(ss_list, sn);
sn = (Snapshot *) ecore_list_remove_node(ss_list, sn);
if (!sn)
return;
@ -194,8 +195,8 @@ SnapshotEwinMatch(const Snapshot * sn, const EWin * ewin)
static int
SnapshotEwinFindMatchCmd(const void *data, const void *match)
{
const Snapshot *sn = data;
const EWin *ewin = match;
const Snapshot *sn = (Snapshot *) data;
const EWin *ewin = (EWin *) match;
return sn->used ||
!(sn->startup_id && SEQ(sn->cmd, ewin->icccm.wm_command) &&
@ -205,8 +206,8 @@ SnapshotEwinFindMatchCmd(const void *data, const void *match)
static int
SnapshotEwinFindMatch(const void *data, const void *match)
{
const Snapshot *sn = data;
const EWin *ewin = match;
const Snapshot *sn = (Snapshot *) data;
const EWin *ewin = (EWin *) match;
return sn->used || !SnapshotEwinMatch(sn, ewin);
}
@ -224,10 +225,10 @@ SnapshotEwinFind(EWin * ewin)
return NULL;
/* If exec'ed by snap try matching command exactly */
sn = ecore_list_find(ss_list, SnapshotEwinFindMatchCmd, ewin);
sn = (Snapshot *) ecore_list_find(ss_list, SnapshotEwinFindMatchCmd, ewin);
if (!sn)
sn = ecore_list_find(ss_list, SnapshotEwinFindMatch, ewin);
sn = (Snapshot *) ecore_list_find(ss_list, SnapshotEwinFindMatch, ewin);
if (sn && !(sn->match_flags & SNAP_MATCH_MULTIPLE))
{
@ -429,7 +430,7 @@ SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
if (sn->groups)
Efree(sn->groups);
sn->groups = Emalloc(sizeof(int) * num_groups);
sn->groups = EMALLOC(int, num_groups);
sn->num_groups = num_groups;
@ -568,7 +569,7 @@ typedef struct
{
char title;
char name;
char class;
char clss;
char role;
} match;
@ -596,7 +597,7 @@ static void
CB_ApplySnap(Dialog * d, int val, void *data __UNUSED__)
{
EWin *ewin;
SnapDlgData *sd = DialogGetData(d);
SnapDlgData *sd = (SnapDlgData *) DialogGetData(d);
unsigned int match_flags, use_flags;
if (val >= 2 || !sd)
@ -613,7 +614,7 @@ CB_ApplySnap(Dialog * d, int val, void *data __UNUSED__)
match_flags |= SNAP_MATCH_TITLE;
if (sd->match.name)
match_flags |= SNAP_MATCH_NAME;
if (sd->match.class)
if (sd->match.clss)
match_flags |= SNAP_MATCH_CLASS;
if (sd->match.role)
match_flags |= SNAP_MATCH_ROLE;
@ -675,9 +676,9 @@ _DlgFillSnap(Dialog * d, DItem * table, void *data)
Snapshot *sn;
SnapDlgData *sd;
char s[1024];
const EWin *ewin = data;
const EWin *ewin = (EWin *) data;
sd = Ecalloc(1, sizeof(SnapDlgData));
sd = ECALLOC(SnapDlgData, 1);
DialogSetData(d, sd);
sd->client = EwinGetClientXwin(ewin);
@ -686,7 +687,7 @@ _DlgFillSnap(Dialog * d, DItem * table, void *data)
{
sd->match.title = (sn->match_flags & SNAP_MATCH_TITLE) != 0;
sd->match.name = (sn->match_flags & SNAP_MATCH_NAME) != 0;
sd->match.class = (sn->match_flags & SNAP_MATCH_CLASS) != 0;
sd->match.clss = (sn->match_flags & SNAP_MATCH_CLASS) != 0;
sd->match.role = (sn->match_flags & SNAP_MATCH_ROLE) != 0;
if (sn->track_changes)
@ -725,7 +726,7 @@ _DlgFillSnap(Dialog * d, DItem * table, void *data)
if (EwinGetIcccmCName(ewin))
{
sd->match.name = 1;
sd->match.class = 1;
sd->match.clss = 1;
sd->match.role = ewin->icccm.wm_role != NULL;
}
else
@ -765,7 +766,7 @@ _DlgFillSnap(Dialog * d, DItem * table, void *data)
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetAlign(di, 0, 512);
DialogItemSetText(di, _("Class:"));
DialogItemCheckButtonSetPtr(di, &sd->match.class);
DialogItemCheckButtonSetPtr(di, &sd->match.clss);
di = DialogAddItem(table, DITEM_TEXT);
DialogItemSetColSpan(di, 3);
@ -1000,7 +1001,7 @@ CB_RememberWindowSettings(Dialog * d __UNUSED__, int val __UNUSED__, void *data)
rd = (RememberWinList *) data;
/* Make sure its still there */
sn = ecore_list_goto(ss_list, rd->snap);
sn = (Snapshot *) ecore_list_goto(ss_list, rd->snap);
if (!sn || !sn->used)
return;
@ -1019,7 +1020,7 @@ _DlgFillRemember(Dialog * d __UNUSED__, DItem * table, void *data __UNUSED__)
DialogItemTableSetOptions(table, 3, 0, 0, 0);
num = ecore_list_nodes(ss_list);
rd_ewin_list = Emalloc(sizeof(RememberWinList) * (num + 1));
rd_ewin_list = EMALLOC(RememberWinList, num + 1);
if (num > 0)
{
@ -1375,8 +1376,7 @@ LoadSnapInfo(void)
else if (!strcmp(buf, "GROUP"))
{
sn->num_groups++;
sn->groups =
Erealloc(sn->groups, sizeof(int) * sn->num_groups);
sn->groups = EREALLOC(int, sn->groups, sn->num_groups);
sn->groups[sn->num_groups - 1] = atoi(s);
}
@ -1616,7 +1616,7 @@ static const char NoText[] = "-NONE-";
static void
_SnapShow(void *data, void *prm)
{
Snapshot *sn = data;
Snapshot *sn = (Snapshot *) data;
int full = prm != NULL;
char buf[FILEPATH_LEN_MAX];
const char *name;

View File

@ -25,6 +25,7 @@
#include "dialog.h"
#include "e16-ecore_list.h"
#include "emodule.h"
#include "settings.h"
#ifdef HAVE_LIBESD
#include <esd.h>
@ -96,7 +97,7 @@ LoadWav(const char *file)
return NULL;
}
s = Emalloc(sizeof(Sample));
s = EMALLOC(Sample, 1);
if (!s)
{
Efree(find);
@ -132,7 +133,8 @@ LoadWav(const char *file)
s->rate = (int)in_rate;
s->samples = frame_count * bytes_per_frame;
s->data = Emalloc(frame_count * bytes_per_frame);
s->data = EMALLOC(unsigned char, frame_count * bytes_per_frame);
frames_read = afReadFrames(in_file, AF_DEFAULT_TRACK, s->data, frame_count);
afCloseFile(in_file);
Efree(find);
@ -192,7 +194,7 @@ SampleDestroy(Sample * s)
static void
_SclassSampleDestroy(void *data, void *user_data __UNUSED__)
{
SoundClass *sclass = data;
SoundClass *sclass = (SoundClass *) data;
if (!sclass || !sclass->sample)
return;
@ -206,7 +208,7 @@ SclassCreate(const char *name, const char *file)
{
SoundClass *sclass;
sclass = Emalloc(sizeof(SoundClass));
sclass = EMALLOC(SoundClass, 1);
if (!sclass)
return NULL;
@ -254,13 +256,13 @@ SclassApply(SoundClass * sclass)
static int
_SclassMatchName(const void *data, const void *match)
{
return strcmp(((const SoundClass *)data)->name, match);
return strcmp(((const SoundClass *)data)->name, (const char *)match);
}
static SoundClass *
SclassFind(const char *name)
{
return ecore_list_find(sound_list, _SclassMatchName, name);
return (SoundClass *) ecore_list_find(sound_list, _SclassMatchName, name);
}
void
@ -525,6 +527,7 @@ static const CfgItem SoundCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModSound;
const EModule ModSound = {
"sound", "audio",
SoundSighan,

View File

@ -91,7 +91,7 @@ EobjListAdd(EobjList * ewl, EObj * eo, int ontop)
if (ewl->nwins >= ewl->nalloc)
{
ewl->nalloc += 16;
ewl->list = (EObj **) Erealloc(ewl->list, ewl->nalloc * sizeof(EObj *));
ewl->list = EREALLOC(EObj *, ewl->list, ewl->nalloc);
}
if (ewl->layered)
@ -357,7 +357,7 @@ EwinListStackGet(int *num)
if (nalloc < newins)
{
nalloc = (newins + 16) & ~0xf; /* 16 at the time */
lst = Erealloc(lst, nalloc * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, nalloc);
}
for (i = j = 0; i < ewl->nwins; i++)
@ -394,7 +394,7 @@ EwinListGetForDesk(int *num, Desk * dsk)
if (nalloc < newins)
{
nalloc = (newins + 16) & ~0xf; /* 16 at the time */
lst = Erealloc(lst, nalloc * sizeof(EWin *));
lst = EREALLOC(EWin *, lst, nalloc);
}
for (i = j = 0; i < ewl->nwins; i++)
@ -425,7 +425,7 @@ EobjListStackGetForDesk(int *num, Desk * dsk)
if (nalloc < ewl->nwins)
{
nalloc = (ewl->nwins + 16) & ~0xf; /* 16 at the time */
lst = Erealloc(lst, nalloc * sizeof(EWin *));
lst = EREALLOC(EObj *, lst, nalloc);
}
for (i = j = 0; i < ewl->nwins; i++)

View File

@ -157,7 +157,7 @@ doStartupWindowsOpen(int val, void *data __UNUSED__)
#if TEST_STARTUP_USING_TIMER
ESync();
k = TIME_STEP * Conf.desks.slidespeed / 2;
k = (int)(TIME_STEP * Conf.desks.slidespeed / 2);
if (k <= 0)
k = 1;
val += k;

View File

@ -176,7 +176,7 @@ SystrayObjAdd(Container * ct, Window xwin)
break;
}
swin = Emalloc(sizeof(SWin));
swin = EMALLOC(SWin, 1);
if (!swin)
goto bail_out;
@ -222,7 +222,7 @@ SystrayObjDel(Container * ct, Win win, int gone)
if (EDebug(EDBUG_TYPE_ICONBOX))
Eprintf("SystrayObjDel %#lx\n", WinGetXwin(win));
swin = ct->objs[i].obj;
swin = (SWin *) ct->objs[i].obj;
ContainerObjectDel(ct, swin);
@ -243,7 +243,7 @@ SystrayObjMapUnmap(Container * ct, Window win)
if (i < 0)
return;
swin = ct->objs[i].obj;
swin = (SWin *) ct->objs[i].obj;
if (SystrayGetXembedInfo(win, xembed_info) >= 0)
{
@ -334,7 +334,7 @@ SystraySelectionEvent(Win win __UNUSED__, XEvent * ev, void *prm)
break;
case ClientMessage:
SystrayEventClientMessage(prm, &(ev->xclient));
SystrayEventClientMessage((Container *) prm, &(ev->xclient));
break;
}
}
@ -377,7 +377,7 @@ SystrayEvent(Win _win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
static void
SystrayItemEvent(Win win, XEvent * ev, void *prm)
{
Container *ct = prm;
Container *ct = (Container *) prm;
if (EDebug(EDBUG_TYPE_ICONBOX))
Eprintf("SystrayItemEvent %2d %#lx\n", ev->type, ev->xany.window);
@ -491,6 +491,7 @@ SystrayObjPlace(Container * ct __UNUSED__, ContainerObject * cto,
}
}
extern const ContainerOps SystrayOps;
const ContainerOps SystrayOps = {
SystrayInit,
SystrayExit,

View File

@ -51,7 +51,7 @@ TextstateCreate(void)
{
TextState *ts;
ts = Ecalloc(1, sizeof(TextState));
ts = ECALLOC(TextState, 1);
if (!ts)
return NULL;
@ -76,7 +76,7 @@ TextclassCreate(const char *name)
{
TextClass *tc;
tc = Ecalloc(1, sizeof(TextClass));
tc = ECALLOC(TextClass, 1);
if (!tc)
return NULL;
@ -208,7 +208,7 @@ TextclassPopulate(TextClass * tclass)
static int
_TextclassMatchName(const void *data, const void *match)
{
return strcmp(((const TextClass *)data)->name, match);
return strcmp(((const TextClass *)data)->name, (const char *)match);
}
TextClass *
@ -218,12 +218,16 @@ TextclassFind(const char *name, int fallback)
if (name)
{
tc = ecore_list_find(tclass_list, _TextclassMatchName, name);
tc =
(TextClass *) ecore_list_find(tclass_list, _TextclassMatchName,
name);
if (tc || !fallback)
return tc;
}
tc = ecore_list_find(tclass_list, _TextclassMatchName, "__FALLBACK_TCLASS");
tc =
(TextClass *) ecore_list_find(tclass_list, _TextclassMatchName,
"__FALLBACK_TCLASS");
return tc;
}
@ -623,6 +627,7 @@ static const IpcItem TextclassIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModTextclass;
const EModule ModTextclass = {
"textclass", "tc",
TextclassSighan,

View File

@ -270,7 +270,7 @@ TextstateTextFit1(TextState * ts, char **ptext, int *pw, int textwidth_limit)
len = strlen(text);
if (len <= 1)
return;
new_line = Emalloc(len + 10);
new_line = EMALLOC(char, len + 10);
if (!new_line)
return;
@ -308,7 +308,8 @@ TextstateTextFit2(TextState * ts, char **ptext, int *pw, int textwidth_limit)
int len;
len = strlen(text);
new_line = Emalloc(len + 20);
new_line = EMALLOC(char, len + 20);
if (!new_line)
return;
@ -355,14 +356,15 @@ TextstateTextFitMB(TextState * ts, char **ptext, int *pw, int textwidth_limit)
if (wc_len <= 1)
goto done;
wc_line = (wchar_t *) Emalloc((wc_len + 1) * sizeof(wchar_t));
wc_line = EMALLOC(wchar_t, wc_len + 1);
if (!wc_line)
goto done;
if (EwcStrToWcs(text, len, wc_line, wc_len) <= 0)
goto done;
new_line = Emalloc(len + 10);
new_line = EMALLOC(char, len + 10);
if (!new_line)
goto done;
@ -446,7 +448,7 @@ _xft_Load(TextState * ts, int fallback __UNUSED__)
}
#endif
fdc = Emalloc(sizeof(FontCtxXft));
fdc = EMALLOC(FontCtxXft, 1);
if (!fdc)
return -1;
fdc->font = font;
@ -597,7 +599,7 @@ _xfs_Load(TextState * ts, int fallback)
Eprintf("- XFontsOfFontSet %d: %s\n", i, fn[i]);
}
fdc = Emalloc(sizeof(FontCtxXfs));
fdc = EMALLOC(FontCtxXfs, 1);
if (!fdc)
return -1;
fdc->font = font;
@ -709,7 +711,7 @@ _xfont_Load(TextState * ts, int fallback __UNUSED__)
return -1; /* Failed */
done:
fdc = Emalloc(sizeof(FontCtxXfont));
fdc = EMALLOC(FontCtxXfont, 1);
if (!fdc)
return -1;
fdc->font = font;

View File

@ -147,7 +147,7 @@ append_merge_dir(char *dir, char ***list, int *count)
}
(*count)++;
(*list) = Erealloc(*list, (*count) * sizeof(char *));
*list = EREALLOC(char *, *list, *count);
(*list)[(*count) - 1] = Estrdup(ss);
}
@ -509,6 +509,7 @@ static const CfgItem ThemeCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModTheme;
const EModule ModTheme = {
"theme", "th",
ThemesSighan,

View File

@ -55,7 +55,7 @@ DoIn(const char *name, double in_time, void (*func) (int val, void *data),
Qentry *qe, *ptr, *pptr;
RemoveTimerEvent(name);
qe = Emalloc(sizeof(Qentry));
qe = EMALLOC(Qentry, 1);
if (!qe)
return;
@ -182,7 +182,7 @@ IdlerAdd(int order, IdlerFunc * func, void *data)
{
Idler *id;
id = Emalloc(sizeof(Idler));
id = EMALLOC(Idler, 1);
if (!id)
return NULL;

View File

@ -29,6 +29,7 @@
#include "emodule.h"
#include "eobj.h"
#include "iclass.h"
#include "settings.h"
#include "tclass.h"
#include "timers.h"
#include "tooltips.h"
@ -99,7 +100,7 @@ TooltipCreate(const char *name, ImageClass * ic0, ImageClass * ic1,
if (ic0 == NULL || tclass == NULL)
return NULL;
tt = Ecalloc(1, sizeof(ToolTip));
tt = ECALLOC(ToolTip, 1);
if (!tt)
return NULL;
@ -312,7 +313,7 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
if (ac)
{
num = ActionclassGetActionCount(ac);
heights = Emalloc(num * sizeof(int));
heights = EMALLOC(int, num);
for (i = 0; i < num; i++)
{
@ -714,13 +715,13 @@ TooltipHide(ToolTip * tt)
static int
_TooltipMatchName(const void *data, const void *match)
{
return strcmp(((const ToolTip *)data)->name, match);
return strcmp(((const ToolTip *)data)->name, (const char *)match);
}
ToolTip *
TooltipFind(const char *name)
{
return ecore_list_find(tt_list, _TooltipMatchName, name);
return (ToolTip *) ecore_list_find(tt_list, _TooltipMatchName, name);
}
/*
@ -926,6 +927,7 @@ static const CfgItem TooltipsCfgItems[] = {
/*
* Module descriptor
*/
extern const EModule ModTooltips;
const EModule ModTooltips = {
"tooltips", "tt",
TooltipsSighan,

View File

@ -131,7 +131,7 @@ _ift_Load(TextState * ts, int fallback __UNUSED__)
if (!font)
return -1;
fdc = Emalloc(sizeof(FontCtxIft));
fdc = EMALLOC(FontCtxIft, 1);
if (!fdc)
return -1;
fdc->font = font;

View File

@ -48,6 +48,10 @@
#define Efree free
#define Erealloc realloc
#define ECALLOC(type, num) (type*)Ecalloc(num, sizeof(type))
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))
#define _EFREE(p) do { if (p) { Efree(p); p = NULL; } } while (0)
#define _EFDUP(p, s) do { if (p) Efree(p); p = Estrdup(s); } while (0)

View File

@ -75,7 +75,7 @@ WarpFocusWinCreate(void)
{
WarpFocusWin *fw;
fw = Ecalloc(1, sizeof(WarpFocusWin));
fw = ECALLOC(WarpFocusWin, 1);
if (!fw)
return fw;
@ -307,8 +307,7 @@ WarpFocus(int delta)
((!ewin->state.iconified) || (Conf.warplist.showiconified)))
{
warplist_num++;
warplist = Erealloc(warplist,
warplist_num * sizeof(WarplistItem));
warplist = EREALLOC(WarplistItem, warplist, warplist_num);
wl = warplist + warplist_num - 1;
wl->ewin = ewin;
}
@ -483,6 +482,7 @@ static const CfgItem WarplistCfgItems[] = {
};
#define N_CFG_ITEMS (sizeof(WarplistCfgItems)/sizeof(CfgItem))
extern const EModule ModWarplist;
const EModule ModWarplist = {
"warplist", "warp",
WarplistSighan,

View File

@ -101,7 +101,7 @@ WindowMatchCreate(const char *name)
{
WindowMatch *b;
b = Ecalloc(1, sizeof(WindowMatch));
b = ECALLOC(WindowMatch, 1);
if (!b)
return NULL;
@ -614,8 +614,8 @@ typedef struct
static int
WindowMatchTypeMatch(const void *data, const void *match)
{
const WindowMatch *wm = data;
const wmatch_type_data *wmtd = match;
const WindowMatch *wm = (WindowMatch *) data;
const wmatch_type_data *wmtd = (wmatch_type_data *) match;
return !(wm->op == wmtd->type && WindowMatchEwinTest(wm, wmtd->ewin));
}
@ -628,7 +628,7 @@ WindowMatchType(const EWin * ewin, int type)
wmtd.type = type;
wmtd.ewin = ewin;
return ecore_list_find(wm_list, WindowMatchTypeMatch, &wmtd);
return (WindowMatch *) ecore_list_find(wm_list, WindowMatchTypeMatch, &wmtd);
}
Border *
@ -996,6 +996,7 @@ static const IpcItem WindowMatchIpcArray[] = {
/*
* Module descriptor
*/
extern const EModule ModWindowMatch;
const EModule ModWindowMatch = {
"winmatch", NULL,
WindowMatchSighan,

19
src/x.c
View File

@ -109,7 +109,7 @@ EXidCreate(void)
{
EXID *xid;
xid = Ecalloc(1, sizeof(EXID));
xid = ECALLOC(EXID, 1);
xid->bgcol = 0xffffffff;
return xid;
@ -244,8 +244,7 @@ EventCallbackRegister(Win win, int type __UNUSED__, EventCallbackFunc * func,
#endif
xid->cbl.num++;
xid->cbl.lst =
Erealloc(xid->cbl.lst, xid->cbl.num * sizeof(EventCallbackItem));
xid->cbl.lst = EREALLOC(EventCallbackItem, xid->cbl.lst, xid->cbl.num);
eci = xid->cbl.lst + xid->cbl.num - 1;
eci->func = func;
eci->prm = prm;
@ -277,7 +276,7 @@ EventCallbackUnregister(Win win, int type __UNUSED__,
for (; i < ecl->num; i++, eci++)
*eci = *(eci + 1);
xid->cbl.lst =
Erealloc(xid->cbl.lst, ecl->num * sizeof(EventCallbackItem));
EREALLOC(EventCallbackItem, xid->cbl.lst, ecl->num);
}
else
{
@ -1271,7 +1270,7 @@ EShapeGetRectangles(Win win, int dest, int *rn, int *ord)
*ord = xid->ord;
if (xid->num_rect > 0)
{
r = Emalloc(sizeof(XRectangle) * xid->num_rect);
r = EMALLOC(XRectangle, xid->num_rect);
if (!r)
return NULL;
memcpy(r, xid->rects, sizeof(XRectangle) * xid->num_rect);
@ -1288,7 +1287,7 @@ EShapeGetRectangles(Win win, int dest, int *rn, int *ord)
r = XShapeGetRectangles(disp, win->xwin, dest, rn, ord);
if (r)
{
rr = Emalloc(sizeof(XRectangle) * *rn);
rr = EMALLOC(XRectangle, *rn);
if (!rr)
return NULL;
memcpy(rr, r, sizeof(XRectangle) * *rn);
@ -1396,7 +1395,7 @@ EShapePropagate(Win win)
if (rn > 0)
{
rl = xch->rects;
rects = Erealloc(rects, (num_rects + rn) * sizeof(XRectangle));
rects = EREALLOC(XRectangle, rects, num_rects + rn);
/* go through all clip rects in thsi window's shape */
for (k = 0; k < rn; k++)
{
@ -1417,7 +1416,7 @@ EShapePropagate(Win win)
else if (rn == 0)
{
/* Unshaped */
rects = Erealloc(rects, (num_rects + 1) * sizeof(XRectangle));
rects = EREALLOC(XRectangle, rects, num_rects + 1);
rects[num_rects].x = x;
rects[num_rects].y = y;
@ -1724,7 +1723,11 @@ EVisualFindARGB(void)
xvit.screen = VRoot.scr;
xvit.depth = 32;
#if __cplusplus
xvit.c_class = TrueColor;
#else
xvit.class = TrueColor;
#endif
xvi = XGetVisualInfo(disp,
VisualScreenMask | VisualDepthMask | VisualClassMask,