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 fi
AM_CONDITIONAL(BUILD_ROOTHACKLIB, test "x$enable_roothacklib" = "xyes") 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, AC_ARG_ENABLE(gcc-warnings,
[ --enable-gcc-warnings enable GCC compiler warnings @<:@default=no@:>@],, [ --enable-gcc-warnings enable GCC compiler warnings @<:@default=no@:>@],,
enable_gcc_warnings=no) enable_gcc_warnings=no)
if test "x$enable_gcc_warnings" = "xyes"; then 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 fi
AC_SUBST(E_X_LIBS) 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, Window win_main, win_title, win_exit, win_next, win_prev, win_text,
win_cover; win_cover;
Imlib_Image *im_text; Imlib_Image im_text;
Imlib_Image *im_title; Imlib_Image im_title;
Imlib_Image *im_prev1, *im_prev2; Imlib_Image im_prev1, im_prev2;
Imlib_Image *im_next1, *im_next2; Imlib_Image im_next1, im_next2;
Imlib_Image *im_exit1, *im_exit2; Imlib_Image im_exit1, im_exit2;
char *docdir = NULL; char *docdir = NULL;
static Atom ATOM_WM_DELETE_WINDOW = None; static Atom ATOM_WM_DELETE_WINDOW = None;
@ -163,10 +163,10 @@ CreateWindow(Window parent, int x, int y, int ww, int hh)
return win; return win;
} }
static Imlib_Image * static Imlib_Image
LoadImage(const char *file) LoadImage(const char *file)
{ {
Imlib_Image *im; Imlib_Image im;
char tmp[4096]; char tmp[4096];
sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file); sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
@ -177,7 +177,7 @@ LoadImage(const char *file)
} }
static void static void
ApplyImage1(Window win, Imlib_Image * im) ApplyImage1(Window win, Imlib_Image im)
{ {
Pixmap pmap = 0, mask = 0; Pixmap pmap = 0, mask = 0;
@ -189,7 +189,7 @@ ApplyImage1(Window win, Imlib_Image * im)
} }
static void static void
ApplyImage2(Window win, Imlib_Image * im) ApplyImage2(Window win, Imlib_Image im)
{ {
imlib_context_set_image(im); imlib_context_set_image(im);
imlib_context_set_drawable(win); imlib_context_set_drawable(win);
@ -296,7 +296,8 @@ main(int argc, char **argv)
} }
if (docdir == NULL) if (docdir == NULL)
docdir = strdup("."); 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); sprintf(s, "%s/%s", docdir, docfile);
findLocalizedFile(s); findLocalizedFile(s);
@ -414,7 +415,8 @@ main(int argc, char **argv)
XMapWindow(disp, win_main); XMapWindow(disp, win_main);
XSync(disp, False); XSync(disp, False);
page_hist = malloc(sizeof(int));
page_hist = EMALLOC(int, 1);
page_hist[0] = 0; page_hist[0] = 0;
@ -529,7 +531,8 @@ main(int argc, char **argv)
if (dirlen > 1) if (dirlen > 1)
{ {
free(docdir); free(docdir);
docdir = malloc(dirlen + 1); docdir = EMALLOC(char, dirlen + 1);
memcpy(docdir, exe, dirlen); memcpy(docdir, exe, dirlen);
docdir[dirlen] = 0; docdir[dirlen] = 0;
} }
@ -537,7 +540,7 @@ main(int argc, char **argv)
pclose(p); pclose(p);
if (page_hist) if (page_hist)
free(page_hist); free(page_hist);
page_hist = malloc(sizeof(int)); page_hist = EMALLOC(int, 1);
page_hist[0] = 0; page_hist[0] = 0;
page_hist_len = 1; page_hist_len = 1;
@ -560,9 +563,8 @@ main(int argc, char **argv)
{ {
page_hist_len++; page_hist_len++;
page_hist = page_hist =
realloc(page_hist, EREALLOC(int, page_hist,
sizeof(int) * page_hist_len);
page_hist_len);
} }
page_hist[page_hist_pos] = pagenum; page_hist[page_hist_pos] = pagenum;
l = RenderPage(draw, pagenum, w, h); l = RenderPage(draw, pagenum, w, h);
@ -602,8 +604,7 @@ main(int argc, char **argv)
if (page_hist_pos >= page_hist_len) if (page_hist_pos >= page_hist_len)
{ {
page_hist_len++; page_hist_len++;
page_hist = realloc(page_hist, page_hist = EREALLOC(int, page_hist, page_hist_len);
sizeof(int) * page_hist_len);
page_hist[page_hist_pos] = pagenum; page_hist[page_hist_pos] = pagenum;
} }

View File

@ -217,7 +217,11 @@ extern Display *disp;
extern Root VRoot; extern Root VRoot;
extern char *docdir; 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 #define Esnprintf snprintf

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,34 +56,44 @@ MyRoot(Display * dpy)
return root; 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 */ /* XCreateWindow intercept hack */
Window Window
XCreateWindow(Display * display, Window parent, int x, int y, XCreateWindow(Display * display, Window parent, int x, int y,
unsigned int width, unsigned int height, unsigned int width, unsigned int height,
unsigned int border_width, unsigned int border_width,
int depth, unsigned int class, Visual * visual, int depth, unsigned int clss, Visual * visual,
unsigned long valuemask, XSetWindowAttributes * attributes) unsigned long valuemask, XSetWindowAttributes * attributes)
{ {
static Window(*func) static CWF *func = NULL;
(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;
/* find the real Xlib and the real X function */ /* find the real Xlib and the real X function */
if (!lib_xlib) if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func) if (!func)
func = dlsym(lib_xlib, "XCreateWindow"); func = (CWF *) dlsym(lib_xlib, "XCreateWindow");
if (parent == DefaultRootWindow(display)) if (parent == DefaultRootWindow(display))
parent = MyRoot(display); parent = MyRoot(display);
return (*func) (display, parent, x, y, width, height, border_width, depth, 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 */ /* XCreateSimpleWindow intercept hack */
Window Window
XCreateSimpleWindow(Display * display, Window parent, int x, int y, 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 int border_width,
unsigned long border, unsigned long background) unsigned long border, unsigned long background)
{ {
static Window(*func) static CSWF *func = NULL;
(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;
/* find the real Xlib and the real X function */ /* find the real Xlib and the real X function */
if (!lib_xlib) if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func) if (!func)
func = dlsym(lib_xlib, "XCreateSimpleWindow"); func = (CSWF *) dlsym(lib_xlib, "XCreateSimpleWindow");
if (parent == DefaultRootWindow(display)) if (parent == DefaultRootWindow(display))
parent = MyRoot(display); parent = MyRoot(display);
@ -110,19 +116,20 @@ XCreateSimpleWindow(Display * display, Window parent, int x, int y,
border_width, border, background); border_width, border, background);
} }
typedef int (RWF) (Display * _display, Window _window, Window _parent,
int x, int y);
/* XReparentWindow intercept hack */ /* XReparentWindow intercept hack */
int int
XReparentWindow(Display * display, Window window, Window parent, int x, int y) XReparentWindow(Display * display, Window window, Window parent, int x, int y)
{ {
static int (*func) static RWF *func = NULL;
(Display * _display, Window _window, Window _parent, int _x, int _y) =
NULL;
/* find the real Xlib and the real X function */ /* find the real Xlib and the real X function */
if (!lib_xlib) if (!lib_xlib)
lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
if (!func) if (!func)
func = dlsym(lib_xlib, "XReparentWindow"); func = (RWF *) dlsym(lib_xlib, "XReparentWindow");
if (parent == DefaultRootWindow(display)) if (parent == DefaultRootWindow(display))
parent = MyRoot(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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif
#include "config.h" #include "config.h"
#include "alert.h" #include "alert.h"
@ -62,9 +64,6 @@
#define ENABLE_TRANSPARENCY 1 #define ENABLE_TRANSPARENCY 1
#define ENABLE_THEME_TRANSPARENCY 1 #define ENABLE_THEME_TRANSPARENCY 1
/* dmalloc debugging */
/*#include <dmalloc.h> */
/* sgi's stdio.h has: /* sgi's stdio.h has:
* *
* #if _SGIAPI && _NO_ANSIMODE * #if _SGIAPI && _NO_ANSIMODE

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -55,13 +55,14 @@ Ecore_List *container_list = NULL;
static int static int
_ContainerMatchName(const void *data, const void *match) _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 * static Container *
ContainerFind(const char *name) ContainerFind(const char *name)
{ {
return ecore_list_find(container_list, _ContainerMatchName, name); return (Container *) ecore_list_find(container_list, _ContainerMatchName,
name);
} }
static Container * static Container *
@ -72,7 +73,7 @@ ContainerCreate(const char *name)
if (ContainerFind(name)) if (ContainerFind(name))
return NULL; return NULL;
ct = Ecalloc(1, sizeof(Container)); ct = ECALLOC(Container, 1);
if (!ct) if (!ct)
return NULL; return NULL;
@ -241,7 +242,7 @@ ContainerReconfigure(Container * ct)
static void static void
ContainerEwinLayout(EWin * ewin, int *px, int *py, int *pw, int *ph) 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); ContainerLayout(ct, px, py, pw, ph);
@ -252,7 +253,7 @@ ContainerEwinLayout(EWin * ewin, int *px, int *py, int *pw, int *ph)
static void static void
ContainerEwinMoveResize(EWin * ewin, int resize) ContainerEwinMoveResize(EWin * ewin, int resize)
{ {
Container *ct = ewin->data; Container *ct = (Container *) ewin->data;
if (!resize && !ct->do_update && !TransparencyUpdateNeeded()) if (!resize && !ct->do_update && !TransparencyUpdateNeeded())
return; return;
@ -267,7 +268,7 @@ ContainerEwinMoveResize(EWin * ewin, int resize)
static void static void
ContainerEwinClose(EWin * ewin) ContainerEwinClose(EWin * ewin)
{ {
ContainerDestroy(ewin->data, 0); ContainerDestroy((Container *) ewin->data, 0);
ewin->client.win = NULL; ewin->client.win = NULL;
ewin->data = NULL; ewin->data = NULL;
} }
@ -354,7 +355,7 @@ ContainerObjectAdd(Container * ct, void *obj)
return -1; return -1;
ct->num_objs++; 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; ct->objs[ct->num_objs - 1].obj = obj;
return ct->num_objs - 1; /* Success */ return ct->num_objs - 1; /* Success */
@ -374,7 +375,7 @@ ContainerObjectDel(Container * ct, void *obj)
ct->objs[j] = ct->objs[j + 1]; ct->objs[j] = ct->objs[j + 1];
ct->num_objs--; ct->num_objs--;
if (ct->num_objs > 0) 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 else
{ {
Efree(ct->objs); Efree(ct->objs);
@ -1527,10 +1528,9 @@ CB_ConfigureContainer(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
static void static void
CB_IconSizeSlider(Dialog * d, int val __UNUSED__, void *data) CB_IconSizeSlider(Dialog * d, int val __UNUSED__, void *data)
{ {
DItem *di; DItem *di = (DItem *) data;
char s[256]; char s[256];
di = data;
Esnprintf(s, sizeof(s), _("Icon size: %2d"), tmp_ib_iconsize); Esnprintf(s, sizeof(s), _("Icon size: %2d"), tmp_ib_iconsize);
DialogItemSetText(di, s); DialogItemSetText(di, s);
DialogDrawItems(d, di, 0, 0, 99999, 99999); DialogDrawItems(d, di, 0, 0, 99999, 99999);
@ -1539,7 +1539,7 @@ CB_IconSizeSlider(Dialog * d, int val __UNUSED__, void *data)
static void static void
_DlgFillContainer(Dialog * d, DItem * table, void *data) _DlgFillContainer(Dialog * d, DItem * table, void *data)
{ {
Container *ct = data; Container *ct = (Container *) data;
DItem *di, *table2; DItem *di, *table2;
DItem *radio1, *radio2, *radio3, *radio4, *label; DItem *radio1, *radio2, *radio3, *radio4, *label;
char s[256]; char s[256];
@ -2023,6 +2023,7 @@ static const CfgItem ContainersCfgItems[] = {
/* /*
* Module descriptor * Module descriptor
*/ */
extern const EModule ModIconboxes;
const EModule ModIconboxes = { const EModule ModIconboxes = {
"iconboxes", "ibox", "iconboxes", "ibox",
ContainersSighan, 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); curs = (native_id == 999) ? None : XCreateFontCursor(disp, native_id);
} }
ec = Emalloc(sizeof(ECursor)); ec = EMALLOC(ECursor, 1);
ec->name = Estrdup(name); ec->name = Estrdup(name);
ec->file = Estrdup(image); ec->file = Estrdup(image);
ec->cursor = curs; ec->cursor = curs;
@ -140,13 +140,13 @@ ECursorDestroy(ECursor * ec)
static int static int
_ECursorMatchName(const void *data, const void *match) _ECursorMatchName(const void *data, const void *match)
{ {
return strcmp(((const ECursor *)data)->name, match); return strcmp(((const ECursor *)data)->name, (const char *)match);
} }
ECursor * ECursor *
ECursorFind(const char *name) ECursorFind(const char *name)
{ {
return ecore_list_find(cursor_list, _ECursorMatchName, name); return (ECursor *) ecore_list_find(cursor_list, _ECursorMatchName, name);
} }
static int static int
@ -395,6 +395,7 @@ static const IpcItem CursorIpcArray[] = {
/* /*
* Module descriptor * Module descriptor
*/ */
extern const EModule ModCursors;
const EModule ModCursors = { const EModule ModCursors = {
"cursor", "csr", "cursor", "csr",
CursorSighan, CursorSighan,

View File

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

View File

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

View File

@ -68,11 +68,11 @@ ECreatePixImg(Window win, int w, int h)
XGCValues gcv; XGCValues gcv;
PixImg *pi; PixImg *pi;
pi = Emalloc(sizeof(PixImg)); pi = EMALLOC(PixImg, 1);
if (!pi) if (!pi)
return NULL; return NULL;
pi->shminfo = Emalloc(sizeof(XShmSegmentInfo)); pi->shminfo = EMALLOC(XShmSegmentInfo, 1);
if (pi->shminfo) if (pi->shminfo)
{ {
pi->xim = XShmCreateImage(disp, VRoot.vis, VRoot.depth, ZPixmap, NULL, 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) if (pi->shminfo->shmid >= 0)
{ {
pi->shminfo->shmaddr = pi->xim->data = pi->shminfo->shmaddr = pi->xim->data =
shmat(pi->shminfo->shmid, 0, 0); (char *)shmat(pi->shminfo->shmid, 0, 0);
if (pi->shminfo->shmaddr) if (pi->shminfo->shmaddr)
{ {
pi->shminfo->readOnly = False; 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) 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++) for (i = 0; i < num_ret; i++)
val[i] = ((unsigned long *)prop_ret)[i]; val[i] = ((unsigned long *)prop_ret)[i];
num = num_ret; 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) if (items > 0)
{ {
pstr = malloc(items * sizeof(char *)); pstr = (char **)malloc(items * sizeof(char *));
for (i = 0; i < items; i++) for (i = 0; i < items; i++)
pstr[i] = (list[i] && (*list[i] || i < items - 1)) ? pstr[i] = (list[i] && (*list[i] || i < items - 1)) ?
strdup(list[i]) : NULL; 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? */ /* 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; pstr[0] = (xtp.value) ? strdup((char *)xtp.value) : NULL;
items = 1; 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); &format_ret, &num_ret, &bytes_after, &prop_ret);
if (prop_ret && num_ret > 0 && format_ret == 8) if (prop_ret && num_ret > 0 && format_ret == 8)
{ {
str = malloc(num_ret + 1); str = (char *)malloc(num_ret + 1);
if (str) if (str)
{ {
memcpy(str, prop_ret, num_ret); 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) 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++) for (i = 0; i < num_ret; i++)
alst[i] = ((unsigned long *)prop_ret)[i]; alst[i] = ((unsigned long *)prop_ret)[i];
*val = alst; *val = alst;
@ -541,7 +541,7 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
goto done; goto done;
/* Add it */ /* Add it */
num++; num++;
lst = realloc(lst, num * sizeof(Ecore_X_ID)); lst = (Ecore_X_ID *) realloc(lst, num * sizeof(Ecore_X_ID));
lst[i] = item; lst[i] = item;
} }
@ -1088,7 +1088,7 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root, const char **names,
} }
l = strlen(s) + 1; l = strlen(s) + 1;
buf = realloc(buf, len + l); buf = (char *)realloc(buf, len + l);
memcpy(buf + len, s, l); memcpy(buf + len, s, l);
len += l; len += l;
} }

View File

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

View File

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

View File

@ -54,7 +54,7 @@ e16_db_open(const char *name)
if (!fs) if (!fs)
return NULL; return NULL;
ecf = Ecalloc(1, sizeof(ECfgFile)); ecf = ECALLOC(ECfgFile, 1);
if (!ecf) if (!ecf)
goto done; goto done;
@ -78,7 +78,7 @@ e16_db_open_read(const char *name)
if (!fs) if (!fs)
return NULL; return NULL;
ecf = Ecalloc(1, sizeof(ECfgFile)); ecf = ECALLOC(ECfgFile, 1);
if (!ecf) if (!ecf)
goto done; goto done;
@ -101,7 +101,7 @@ e16_db_open_read(const char *name)
continue; /* Ignore bad format */ continue; /* Ignore bad format */
i = ecf->nitms++; 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].key = Estrdup(key);
ecf->pitms[i].value = Estrdup(s + len); 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, EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
int dx, int dy, int dw, int dh, int ox, int oy) 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 x, y, tx, ty, ww, hh;
int sw, sh; 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 sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh, int scale) int dx, int dy, int dw, int dh, int scale)
{ {
Imlib_Image *im; Imlib_Image im;
scale = (scale) ? 2 : 1; scale = (scale) ? 2 : 1;
@ -447,7 +447,7 @@ EDrawableDumpImage(Drawable draw, const char *txt)
{ {
static int seqn = 0; static int seqn = 0;
char buf[1024]; char buf[1024];
Imlib_Image *im; Imlib_Image im;
int w, h; int w, h;
w = h = 0; w = h = 0;

View File

@ -27,7 +27,7 @@
void void
EModuleRegister(EModule * em) 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; p_modules[n_modules++] = em;
} }
#endif #endif
@ -182,7 +182,7 @@ ModulesGetCfgItems(const CfgItem *** ppi, int *pni)
if (p_modules[i]->cfg.lst) if (p_modules[i]->cfg.lst)
{ {
n = p_modules[i]->cfg.num; 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++) for (j = 0; j < n; j++)
pi[k++] = &(p_modules[i]->cfg.lst[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) if (p_modules[i]->ipc.lst)
{ {
n = p_modules[i]->ipc.num; 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++) for (j = 0; j < n; j++)
pi[k++] = &(p_modules[i]->ipc.lst[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; EObj *eo;
eo = Ecalloc(1, sizeof(EObj)); eo = ECALLOC(EObj, 1);
eo->floating = 1; eo->floating = 1;
EobjSetLayer(eo, 20); EobjSetLayer(eo, 20);
@ -304,11 +304,15 @@ EobjRegister(Window xwin, int type)
if (!win) if (!win)
return NULL; return NULL;
eo = Ecalloc(1, sizeof(EObj)); eo = ECALLOC(EObj, 1);
if (!eo) if (!eo)
return eo; return eo;
#if __cplusplus
if (attr.c_class == InputOnly)
#else
if (attr.class == InputOnly) if (attr.class == InputOnly)
#endif
eo->inputonly = 1; eo->inputonly = 1;
eo->external = 1; eo->external = 1;
@ -586,7 +590,7 @@ EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed)
if (num <= 0) if (num <= 0)
return; return;
xy = Emalloc(sizeof(struct _xy) * num); xy = EMALLOC(struct _xy, num);
if (!xy) if (!xy)
return; return;

View File

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

View File

@ -547,7 +547,7 @@ EventsFetch(XEvent ** evq_p, int *evq_n)
if (count > qsz) if (count > qsz)
{ {
qsz = count; qsz = count;
evq = Erealloc(evq, sizeof(XEvent) * qsz); evq = EREALLOC(XEvent, evq, qsz);
} }
ev = evq + i; ev = evq + i;
for (; i < count; i++, ev++) 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) if (num_wins <= 0)
return; return;
x = Emalloc(sizeof(int) * num_wins); x = EMALLOC(int, num_wins);
y = Emalloc(sizeof(int) * num_wins); y = EMALLOC(int, num_wins);
if (!x || !y) if (!x || !y)
goto done; goto done;
@ -1359,7 +1360,7 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
int i, num; int i, num;
const Border *b; const Border *b;
if (ewin->state.fullscreen == on) if (ewin->state.fullscreen == (unsigned)on)
return; return;
if (on) if (on)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,7 +91,7 @@ EobjListAdd(EobjList * ewl, EObj * eo, int ontop)
if (ewl->nwins >= ewl->nalloc) if (ewl->nwins >= ewl->nalloc)
{ {
ewl->nalloc += 16; ewl->nalloc += 16;
ewl->list = (EObj **) Erealloc(ewl->list, ewl->nalloc * sizeof(EObj *)); ewl->list = EREALLOC(EObj *, ewl->list, ewl->nalloc);
} }
if (ewl->layered) if (ewl->layered)
@ -357,7 +357,7 @@ EwinListStackGet(int *num)
if (nalloc < newins) if (nalloc < newins)
{ {
nalloc = (newins + 16) & ~0xf; /* 16 at the time */ 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++) for (i = j = 0; i < ewl->nwins; i++)
@ -394,7 +394,7 @@ EwinListGetForDesk(int *num, Desk * dsk)
if (nalloc < newins) if (nalloc < newins)
{ {
nalloc = (newins + 16) & ~0xf; /* 16 at the time */ 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++) for (i = j = 0; i < ewl->nwins; i++)
@ -425,7 +425,7 @@ EobjListStackGetForDesk(int *num, Desk * dsk)
if (nalloc < ewl->nwins) if (nalloc < ewl->nwins)
{ {
nalloc = (ewl->nwins + 16) & ~0xf; /* 16 at the time */ 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++) 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 #if TEST_STARTUP_USING_TIMER
ESync(); ESync();
k = TIME_STEP * Conf.desks.slidespeed / 2; k = (int)(TIME_STEP * Conf.desks.slidespeed / 2);
if (k <= 0) if (k <= 0)
k = 1; k = 1;
val += k; val += k;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,6 +48,10 @@
#define Efree free #define Efree free
#define Erealloc realloc #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 _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) #define _EFDUP(p, s) do { if (p) Efree(p); p = Estrdup(s); } while (0)

View File

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

View File

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

19
src/x.c
View File

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