]> granicus.if.org Git - graphviz/commitdiff
Revert "Janitor: clang complains about self assignment"
authorJohn Ellson <ellson@research.att.com>
Thu, 14 Nov 2013 16:58:04 +0000 (11:58 -0500)
committerJohn Ellson <ellson@research.att.com>
Thu, 14 Nov 2013 16:58:04 +0000 (11:58 -0500)
This reverts commit e5b48a5850426f6a1eb8901f36e8f20e4da5e6b8.

lib/common/emit.c
lib/common/labels.c
lib/common/shapes.c
lib/common/textspan.c
lib/common/textspan.h
lib/gvc/gvrender.c

index 04f254a740cc1ede3a40695db692f9e33b39eb3a..40722c1c00e13edec5be1b1cfbd723777c36774a 100644 (file)
@@ -2959,7 +2959,6 @@ boxf xdotBB (Agraph_t* g)
            op->bb = ptsBB (op->op.u.polygon.pts, op->op.u.polygon.cnt, &bb);
            break;
        case xd_text :
-#if 1
            op->span = NEW(textspan_t);
            op->span->str = strdup (op->op.u.text.text);
            op->span->just = adjust [op->op.u.text.align];
@@ -2967,10 +2966,6 @@ boxf xdotBB (Agraph_t* g)
            tf.size = fontsize;
             op->span->font = dtinsert(gvc->textfont_dt, &tf);
            sz = textspan_size (gvc, op->span);
-#else
-// thinking about it ....
-           op->span = new_textspan(gvc, op->op.u.text.text, adjust [op->op.u.text.align], NULL, fontname, fontsize, 0);
-#endif
            bb0 = textBB (op->op.u.text.x, op->op.u.text.y, op->span);
            op->bb = bb0;
            expandBB (&bb, bb0.LL);
index 8d7185e94ed4844c3585ca3e0f430c901192d9fc..157ec2dbd9f2228fc8dad4462ba527c6448995cc 100644 (file)
@@ -183,6 +183,29 @@ textlabel_t *make_label(void *obj, char *str, int kind, double fontsize, char *f
     return rv;
 }
 
+/* free_textspan:
+ * Free resources related to textspan_t.
+ * tl is an array of cnt textspan_t's.
+ * It is also assumed that the text stored in the str field
+ * is all stored in one large buffer shared by all of the textspan_t,
+ * so only the first one needs to free its tlp->str.
+ */
+void free_textspan(textspan_t * tl, int cnt)
+{
+    int i;
+    textspan_t* tlp = tl;
+
+    if (!tl) return;
+    for (i = 0; i < cnt; i++) { 
+       if ((i == 0) && tlp->str)
+           free(tlp->str);
+       if (tlp->layout && tlp->free_layout)
+           tlp->free_layout (tlp->layout);
+       tlp++;
+    }
+    free(tl);
+}
+
 void free_label(textlabel_t * p)
 {
     if (p) {
index 703ed00810ee1a556a01ebd8bcbfae55bb7e9bfa..6dfe7377eed6812c5243539cf9f4bf1a0469b548 100644 (file)
@@ -2398,20 +2398,16 @@ static double invflip_angle(double angle, int rankdir)
            angle = -0.25 * M_PI;
        else if (angle == M_PI * 0.5)
            angle = 0;
-/* clang complains about self assignemnt:
        else if (angle == M_PI * 0.25)
            angle = angle;
- */
        else if (angle == 0)
            angle = M_PI * 0.5;
        else if (angle == M_PI * -0.25)
            angle = M_PI * 0.75;
        else if (angle == M_PI * -0.5)
            angle = M_PI;
-/* clang complains about self assignemnt:
        else if (angle == M_PI * -0.75)
            angle = angle;
- */
        break;
     }
     return angle;
index 5b8e9d717abd8f9d85c3f7741f94b3d2ba261498..9abbbb3a58ce37d03a5006ebd4fbf6d6adcf179f 100644 (file)
@@ -202,8 +202,6 @@ pointf textspan_size(GVC_t *gvc, textspan_t * span)
     assert(span->font);
     font = span->font;
 
-    span->color = span->font->color;
-
     assert(font->name);
 
     /* only need to find alias once per font, since they are unique in dict */
@@ -227,55 +225,6 @@ pointf textspan_size(GVC_t *gvc, textspan_t * span)
     return span->size;
 }
 
-#if 0
-textspan_t * new_textspan(GVC_t *gvc, const char* str, const char *affinity, const char *color, const textfont_t *font)
-{
-       textspan_t *ts;
-
-       ts = calloc(1, sizeof(textspan_t));
-       assert(ts);
-
-       ts->str = strdup(str);
-       assert(ts->str);
-
-//     ts->affinity = strdup(affinity);
-//     assert(ts->affinity);
-
-//     ts->color = strdup(color);
-//     assert(ts->color)
-
-       ts->font = dtinsert(gvc->textfont_dt, font);
-       assert(ts->font);
-
-       textspan_size(gvc, ts);
-
-       return  ts;
-}
-#endif
-
-/* free_textspan:
- * Free resources related to textspan_t.
- * ts is an array of cnt textspan_t's.
- * It is also assumed that the text stored in the str field
- * is all stored in one large buffer shared by all of the textspan_t,
- * so only the first one needs to free its tsp->str.
- */
-void free_textspan(textspan_t * ts, int cnt)
-{
-    int i;
-    textspan_t* tsp = ts;
-
-    if (!ts) return;
-    for (i = 0; i < cnt; i++) {
-        if ((i == 0) && tsp->str)
-            free(tsp->str);
-        if (tsp->layout && tsp->free_layout)
-            tsp->free_layout (tsp->layout);
-        tsp++;
-    }
-    free(ts);
-}
-
 static Void_t* textfont_makef(Dt_t* dt, Void_t* obj, Dtdisc_t* disc)
 {
     textfont_t *f1 = (textfont_t*)obj;
@@ -307,27 +256,20 @@ static int textfont_comparf (Dt_t* dt, Void_t* key1, Void_t* key2, Dtdisc_t* dis
     int rc;
     textfont_t *f1 = (textfont_t*)key1, *f2 = (textfont_t*)key2;
 
-    // C-locale sorted comparison of name, incl. dealing with null
     if (f1->name || f2->name) {
         if (! f1->name) return -1;
         if (! f2->name) return 1;
         rc = strcmp(f1->name, f2->name);
         if (rc) return rc;
     }
-#if 0
-    // FIXME - color is not a useful differentiator of font from a layout pov - move to textspan
-    // C-locale sorted comparison of name, incl. dealing with null
     if (f1->color || f2->color) {
         if (! f1->color) return -1;
         if (! f2->color) return 1;
         rc = strcmp(f1->color, f2->color);
         if (rc) return rc;
     }
-#endif
-    // integer comparison of flags
     rc = (f1->flags - f2->flags);
     if (rc) return rc;
-    // comparison of size doubles - FIXME does this need some tolerance?
     if (f1->size < f2->size) return -1;
     if (f1->size > f2->size) return 1;
     return 0;
index d08cde62fdf6be477e57e2b20172a25a0b0561e7..4682e20c489ed97a8e59c93d2d53048fdd4da858 100644 (file)
@@ -54,7 +54,6 @@ extern "C" {
     /* atomic unit of text emitted using a single htmlfont_t */
     typedef struct {
        char *str;      /* stored in utf-8 */
-       char *color; 
        textfont_t *font;
        void *layout;
        void (*free_layout) (void *layout);   /* FIXME - this is ugly */
index 26732e2f3751f2ebcb01a106a7abbf0fbd5119a6..6074019293e08642369d3b4511c4700d2b7b915b 100644 (file)
@@ -441,7 +441,6 @@ void gvrender_textspan(GVJ_t * job, pointf p, textspan_t * span)
 {
     gvrender_engine_t *gvre = job->render.engine;
     pointf PF;
-    gvcolor_t *color = &(job->obj->pencolor);
 
     if (span->str && span->str[0]
        && (!job->obj           /* because of xdgen non-conformity */
@@ -451,13 +450,6 @@ void gvrender_textspan(GVJ_t * job, pointf p, textspan_t * span)
        else
            PF = gvrender_ptf(job, p);
        if (gvre) {
-#if 1
-            if (span->font->color) {
-                gvrender_resolve_color(job->render.features, span->font->color, color);
-               if (gvre->resolve_color)
-                   gvre->resolve_color(job, color);
-            }
-#endif
            if (gvre->textspan)
                gvre->textspan(job, PF, span);
        }