Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/dox


Modified Files:
        dox.c dox.h format.c text.c ttfont.c 


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

===================================================================
RCS file: /cvs/e/e16/e/dox/dox.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- dox.c       13 Jan 2007 19:14:25 -0000      1.40
+++ dox.c       17 Jan 2007 01:10:40 -0000      1.41
@@ -50,11 +50,11 @@
 
 Window              win_main, win_title, win_exit, win_next, win_prev, 
win_text,
    win_cover;
-Imlib_Image        *im_text;
-Imlib_Image        *im_title;
-Imlib_Image        *im_prev1, *im_prev2;
-Imlib_Image        *im_next1, *im_next2;
-Imlib_Image        *im_exit1, *im_exit2;
+Imlib_Image         im_text;
+Imlib_Image         im_title;
+Imlib_Image         im_prev1, im_prev2;
+Imlib_Image         im_next1, im_next2;
+Imlib_Image         im_exit1, im_exit2;
 char               *docdir = NULL;
 
 static Atom         ATOM_WM_DELETE_WINDOW = None;
@@ -163,10 +163,10 @@
    return win;
 }
 
-static Imlib_Image *
+static              Imlib_Image
 LoadImage(const char *file)
 {
-   Imlib_Image        *im;
+   Imlib_Image         im;
    char                tmp[4096];
 
    sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
@@ -177,7 +177,7 @@
 }
 
 static void
-ApplyImage1(Window win, Imlib_Image * im)
+ApplyImage1(Window win, Imlib_Image im)
 {
    Pixmap              pmap = 0, mask = 0;
 
@@ -189,7 +189,7 @@
 }
 
 static void
-ApplyImage2(Window win, Imlib_Image * im)
+ApplyImage2(Window win, Imlib_Image im)
 {
    imlib_context_set_image(im);
    imlib_context_set_drawable(win);
@@ -296,7 +296,8 @@
      }
    if (docdir == NULL)
       docdir = strdup(".");
-   s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
+   s = EMALLOC(char, strlen(docdir) + strlen(docfile) + 2 + 20);
+
    sprintf(s, "%s/%s", docdir, docfile);
    findLocalizedFile(s);
 
@@ -414,7 +415,8 @@
    XMapWindow(disp, win_main);
 
    XSync(disp, False);
-   page_hist = malloc(sizeof(int));
+
+   page_hist = EMALLOC(int, 1);
 
    page_hist[0] = 0;
 
@@ -529,7 +531,8 @@
                                      if (dirlen > 1)
                                        {
                                           free(docdir);
-                                          docdir = malloc(dirlen + 1);
+                                          docdir = EMALLOC(char, dirlen + 1);
+
                                           memcpy(docdir, exe, dirlen);
                                           docdir[dirlen] = 0;
                                        }
@@ -537,7 +540,7 @@
                                      pclose(p);
                                      if (page_hist)
                                         free(page_hist);
-                                     page_hist = malloc(sizeof(int));
+                                     page_hist = EMALLOC(int, 1);
 
                                      page_hist[0] = 0;
                                      page_hist_len = 1;
@@ -560,9 +563,8 @@
                                        {
                                           page_hist_len++;
                                           page_hist =
-                                             realloc(page_hist,
-                                                     sizeof(int) *
-                                                     page_hist_len);
+                                             EREALLOC(int, page_hist,
+                                                      page_hist_len);
                                        }
                                      page_hist[page_hist_pos] = pagenum;
                                      l = RenderPage(draw, pagenum, w, h);
@@ -602,8 +604,7 @@
                       if (page_hist_pos >= page_hist_len)
                         {
                            page_hist_len++;
-                           page_hist = realloc(page_hist,
-                                               sizeof(int) * page_hist_len);
+                           page_hist = EREALLOC(int, page_hist, page_hist_len);
 
                            page_hist[page_hist_pos] = pagenum;
                         }
===================================================================
RCS file: /cvs/e/e16/e/dox/dox.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- dox.h       13 Jan 2007 19:14:25 -0000      1.40
+++ dox.h       17 Jan 2007 01:10:40 -0000      1.41
@@ -217,7 +217,11 @@
 extern Root         VRoot;
 extern char        *docdir;
 
-#define Emalloc malloc
-#define Efree   free
+#define Efree       free
+#define Emalloc     malloc
+#define Erealloc    realloc
+
+#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
+#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))
 
 #define Esnprintf snprintf
===================================================================
RCS file: /cvs/e/e16/e/dox/format.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- format.c    13 Jan 2007 19:14:25 -0000      1.21
+++ format.c    17 Jan 2007 01:10:40 -0000      1.22
@@ -58,7 +58,7 @@
 AddPage(Object * obj)
 {
    num_pages++;
-   page = realloc(page, sizeof(Page) * (num_pages));
+   page = EREALLOC(Page, page, num_pages);
    page[num_pages - 1].name = NULL;
    page[num_pages - 1].count = 0;
    page[num_pages - 1].obj = NULL;
@@ -91,8 +91,7 @@
 {
    page[num_pages - 1].count++;
    page[num_pages - 1].obj =
-      realloc(page[num_pages - 1].obj,
-             sizeof(Object) * (page[num_pages - 1].count));
+      EREALLOC(Object, page[num_pages - 1].obj, page[num_pages - 1].count);
    page[num_pages - 1].obj[page[num_pages - 1].count - 1].type = obj->type;
    page[num_pages - 1].obj[page[num_pages - 1].count - 1].object = obj->object;
 }
@@ -110,7 +109,8 @@
      case IMG:
        if (!obj->object)
          {
-            img = obj->object = malloc(sizeof(Img_));
+            img = EMALLOC(Img_, 1);
+            obj->object = img;
             img->src = NULL;
             img->src2 = NULL;
             img->src3 = NULL;
@@ -138,7 +138,8 @@
      case FONT:
        if (!obj->object)
          {
-            fn = obj->object = malloc(sizeof(Font_));
+            fn = EMALLOC(Font_, 1);
+            obj->object = fn;
             fn->face = NULL;
             fn->r = 0;
             fn->g = 0;
@@ -167,7 +168,8 @@
      case P:
        if (!obj->object)
          {
-            p = obj->object = malloc(sizeof(P_));
+            p = EMALLOC(P_, 1);
+            obj->object = p;
             p->align = 0;
          }
        if (!strcmp(var, "align"))
@@ -182,7 +184,8 @@
      case PAGE:
        if (!obj->object)
          {
-            pg = obj->object = malloc(sizeof(Page));
+            pg = EMALLOC(Page, 1);
+            obj->object = pg;
             pg->columns = 1;
             pg->padding = 1;
             pg->name = NULL;
@@ -354,9 +357,11 @@
    while ((count = fread(buf, 1, 4096, f)) > 0)
      {
        if (!fdat)
-          fdat = malloc(count);
+          fdat = EMALLOC(char, count);
+
        else
-          fdat = realloc(fdat, (fdat_size + count));
+          fdat = EREALLOC(char, fdat, fdat_size + count);
+
        memcpy(fdat + fdat_size, buf, count);
        fdat_size += count;
      }
@@ -513,7 +518,7 @@
    int                 x, y;
    int                 justification = 0;
    int                 firstp = 1;
-   Imlib_Image        *im;
+   Imlib_Image         im;
    int                 wastext = 0;
 
    ts.fontname = NULL;
@@ -557,7 +562,7 @@
        switch (pg->obj[i].type)
          {
          case IMG:
-            img = pg->obj[i].object;
+            img = (Img_ *) pg->obj[i].object;
             if (img->src)
               {
                  char                tmp[4096];
@@ -578,7 +583,7 @@
                    {
                       Link               *l;
 
-                      l = malloc(sizeof(Link));
+                      l = EMALLOC(Link, 1);
                       l->name = strdup(img->link);
                       l->x = img->x;
                       l->y = img->y;
@@ -595,7 +600,7 @@
             wastext = 0;
             break;
          case FONT:
-            fn = pg->obj[i].object;
+            fn = (Font_ *) pg->obj[i].object;
             ts.fontname = NULL;
             ESetColor(&ts.fg_col, 0, 0, 0);
             ESetColor(&ts.bg_col, 0, 0, 0);
@@ -616,7 +621,7 @@
             TextStateLoadFont(&ts);
             break;
          case P:
-            p = pg->obj[i].object;
+            p = (P_ *) pg->obj[i].object;
             if (p)
                justification = (int)((p->align / 100) * 1024);
             else
@@ -627,7 +632,7 @@
                firstp = 0;
             break;
          case TEXT:
-            txt = pg->obj[i].object;
+            txt = (char *)pg->obj[i].object;
             wc = 1;
             ss[0] = 0;
             s[0] = 0;
@@ -741,7 +746,7 @@
                    {
                       if (pg->obj[j].type == IMG)
                         {
-                           img = pg->obj[j].object;
+                           img = (Img_ *) pg->obj[j].object;
                            if ((img->w > 0) && (img->h > 0))
                              {
                                 int                 ix, iy, iix, iiy;
@@ -846,7 +851,8 @@
                                        {
                                           if (pg->obj[j].type == IMG)
                                             {
-                                               img = pg->obj[j].object;
+                                               img =
+                                                  (Img_ *) pg->obj[j].object;
                                                if ((img->w > 0)
                                                    && (img->h > 0))
                                                  {
@@ -950,7 +956,7 @@
                                 {
                                    Link               *l;
 
-                                   l = malloc(sizeof(Link));
+                                   l = EMALLOC(Link, 1);
                                    l->name = strdup(link_link);
                                    l->x = x + off + lx + extra;
                                    l->y = y;
===================================================================
RCS file: /cvs/e/e16/e/dox/text.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- text.c      13 Jan 2007 19:14:25 -0000      1.21
+++ text.c      17 Jan 2007 01:10:40 -0000      1.22
@@ -41,8 +41,8 @@
        while ((text[j]) && (text[j] != '\n'))
           j++;
        k++;
-       list = realloc(list, sizeof(char *) * k);
-       list[k - 1] = malloc(sizeof(char) * (j - i + 1));
+       list = EREALLOC(char *, list, k);
+       list[k - 1] = EMALLOC(char, j - i + 1);
 
        strncpy(list[k - 1], &(text[i]), (j - i));
        list[k - 1][j - i] = 0;
===================================================================
RCS file: /cvs/e/e16/e/dox/ttfont.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ttfont.c    13 Jan 2007 19:14:25 -0000      1.20
+++ ttfont.c    17 Jan 2007 01:10:40 -0000      1.21
@@ -24,7 +24,7 @@
 
 struct _efont
 {
-   Imlib_Font         *face;
+   Imlib_Font          face;
 };
 
 static void
@@ -80,14 +80,14 @@
 {
    char                s[4096];
    Efont              *f;
-   Imlib_Font         *ff;
+   Imlib_Font          ff;
 
    Esnprintf(s, sizeof(s), "%s/%d", file, size);
    ff = imlib_load_font(s);
    if (ff == NULL)
       return NULL;
 
-   f = Emalloc(sizeof(Efont));
+   f = EMALLOC(Efont, 1);
    f->face = ff;
 
    return f;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to