[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ./ChangeLog src/devices/grohtml/html-tabl...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ./ChangeLog src/devices/grohtml/html-tabl... |
Date: |
Tue, 03 May 2005 06:05:36 -0400 |
CVSROOT: /cvsroot/groff
Module name: groff
Branch:
Changes by: Werner LEMBERG <address@hidden> 05/05/03 10:05:33
Modified files:
. : ChangeLog
src/devices/grohtml: html-table.cpp html-text.cpp output.cpp
post-html.cpp
src/devices/grolbp: lbp.h
src/preproc/grn: main.cpp
Log message:
* src/devices/grohtml/post-html.cpp: Use casts to `char *' if using
`a_delete' for `const char *'.
* src/devices/grohtml/post-html.cpp,
src/devices/grohtml/html-table.cpp,
src/devices/grohtml/html-text.cpp, src/devices/grohtml/output.cpp:
Replace malloc/free with new/delete/a_delete.
* src/devices/grolbp/lbp.h: Remove superfluous semicolons which
are prohibited with ANSI C++.
(lbpprintf, vdmprintf): Remove useless `inline' keyword (since the
function has a variable number of arguments).
* src/preproc/grn/main.cpp (doinput): Change return type to `int'.
Simplify function and update all callers.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/ChangeLog.diff?tr1=1.818&tr2=1.819&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/html-table.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/html-text.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/output.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/post-html.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grolbp/lbp.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/preproc/grn/main.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.818 groff/ChangeLog:1.819
--- groff/ChangeLog:1.818 Mon May 2 11:12:04 2005
+++ groff/ChangeLog Tue May 3 10:05:31 2005
@@ -1,3 +1,23 @@
+2004-05-03 Jeff Conrad <address@hidden>
+
+ * src/devices/grohtml/post-html.cpp: Use casts to `char *' if using
+ `a_delete' for `const char *'.
+
+2004-05-03 Werner LEMBERG <address@hidden>
+
+ * src/devices/grohtml/post-html.cpp,
+ src/devices/grohtml/html-table.cpp,
+ src/devices/grohtml/html-text.cpp, src/devices/grohtml/output.cpp:
+ Replace malloc/free with new/delete/a_delete.
+
+ * src/devices/grolbp/lbp.h: Remove superfluous semicolons which
+ are prohibited with ANSI C++.
+ (lbpprintf, vdmprintf): Remove useless `inline' keyword (since the
+ function has a variable number of arguments).
+
+ * src/preproc/grn/main.cpp (doinput): Change return type to `int'.
+ Simplify function and update all callers.
+
2004-05-02 Werner LEMBERG <address@hidden>
Undo getopt changes from 2004-04-30. We don't want a dependency
Index: groff/src/devices/grohtml/html-table.cpp
diff -u groff/src/devices/grohtml/html-table.cpp:1.4
groff/src/devices/grohtml/html-table.cpp:1.5
--- groff/src/devices/grohtml/html-table.cpp:1.4 Wed Feb 16 14:07:24 2005
+++ groff/src/devices/grohtml/html-table.cpp Tue May 3 10:05:32 2005
@@ -63,7 +63,7 @@
while (p != NULL) {
q = p;
p = p->next;
- free(q);
+ delete q;
}
tab = NULL;
}
@@ -150,10 +150,10 @@
while ((*s != (char)0) && !isspace(*s))
s++;
if (last == NULL) {
- tab = (tab_position *)malloc(sizeof(tab_position));
+ tab = new tab_position;
last = tab;
} else {
- last->next = (tab_position *)malloc(sizeof(tab_position));
+ last->next = new tab_position;
last = last->next;
}
last->alignment = align;
@@ -253,7 +253,7 @@
c = columns;
while (columns != NULL) {
columns = columns->next;
- free(c);
+ delete c;
c = columns;
}
}
@@ -269,7 +269,7 @@
while (c != NULL) {
p = c;
c = c->next;
- free(p);
+ delete p;
}
}
@@ -571,7 +571,7 @@
(l->next->left < hend))
return FALSE; // new column bumps into next one
- n = (cols *)malloc(sizeof(cols));
+ n = new cols;
if (l == NULL) {
n->next = columns;
columns = n;
Index: groff/src/devices/grohtml/html-text.cpp
diff -u groff/src/devices/grohtml/html-text.cpp:1.7
groff/src/devices/grohtml/html-text.cpp:1.8
--- groff/src/devices/grohtml/html-text.cpp:1.7 Sun Feb 27 06:26:15 2005
+++ groff/src/devices/grohtml/html-text.cpp Tue May 3 10:05:32 2005
@@ -284,7 +284,7 @@
}
p = stackptr;
stackptr = stackptr->next;
- free(p);
+ delete p;
}
lastptr = NULL;
}
@@ -374,7 +374,7 @@
void html_text::push_para (HTML_TAG t, void *arg, html_indent *in)
{
- tag_definition *p=(tag_definition *)malloc(sizeof(tag_definition));
+ tag_definition *p= new tag_definition;
p->type = t;
p->arg1 = arg;
@@ -394,7 +394,7 @@
void html_text::push_para (color *c)
{
- tag_definition *p=(tag_definition *)malloc(sizeof(tag_definition));
+ tag_definition *p = new tag_definition;
p->type = COLOR_TAG;
p->arg1 = NULL;
@@ -534,7 +534,7 @@
lastptr = NULL;
if (p->indent != NULL)
delete p->indent;
- free(p);
+ delete p;
}
/*
@@ -547,7 +547,7 @@
push_para(temp->type, temp->arg1, temp->indent);
p = temp;
temp = temp->next;
- free(p);
+ delete p;
}
}
return arg;
@@ -879,7 +879,7 @@
if (l->next == NULL)
lastptr = l;
}
- free(p);
+ delete p;
}
}
@@ -945,7 +945,7 @@
if (l->next == NULL)
lastptr = l;
}
- free(p);
+ delete p;
}
/*
* now determine whether text was issued before <br>
Index: groff/src/devices/grohtml/output.cpp
diff -u groff/src/devices/grohtml/output.cpp:1.2
groff/src/devices/grohtml/output.cpp:1.3
--- groff/src/devices/grohtml/output.cpp:1.2 Tue Oct 12 21:39:31 2004
+++ groff/src/devices/grohtml/output.cpp Tue May 3 10:05:32 2005
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
*
* Gaius Mulley (address@hidden) wrote output.cpp
* but it owes a huge amount of ideas and raw code from
@@ -67,7 +67,7 @@
word::word (const char *w, int n)
: next(0)
{
- s = (char *)malloc(n+1);
+ s = new char[n+1];
strncpy(s, w, n);
s[n] = (char)0;
}
@@ -78,7 +78,7 @@
word::~word ()
{
- free(s);
+ a_delete s;
}
/*
Index: groff/src/devices/grohtml/post-html.cpp
diff -u groff/src/devices/grohtml/post-html.cpp:1.22
groff/src/devices/grohtml/post-html.cpp:1.23
--- groff/src/devices/grohtml/post-html.cpp:1.22 Sat Apr 2 12:49:11 2005
+++ groff/src/devices/grohtml/post-html.cpp Tue May 3 10:05:32 2005
@@ -362,7 +362,7 @@
char_block::char_block(int length)
: used(0), next(NULL)
{
- buffer = (char *)malloc(max(length, char_block::SIZE));
+ buffer = new char[max(length, char_block::SIZE)];
if (buffer == NULL)
fatal("out of memory error");
}
@@ -370,7 +370,7 @@
char_block::~char_block()
{
if (buffer != NULL)
- free(buffer);
+ a_delete buffer;
}
class char_buffer {
@@ -1688,16 +1688,16 @@
while (xhead != NULL) {
t = xhead;
xhead = xhead->next;
- free((void *)t->val);
- free((void *)t->id);
- free(t);
+ a_delete t->val;
+ a_delete t->id;
+ delete t;
}
while (yhead != NULL) {
t = yhead;
yhead = yhead->next;
- free((void *)t->val);
- free((void *)t->id);
- free(t);
+ a_delete t->val;
+ a_delete t->id;
+ delete t;
}
}
@@ -1724,7 +1724,7 @@
compare(t, v, f, l);
else {
if (t == NULL) {
- t = (assert_pos *)malloc(sizeof(struct assert_pos));
+ t = new assert_pos;
t->next = *h;
(*h) = t;
}
@@ -1740,9 +1740,9 @@
}
t->id = i;
t->val = v;
- a_delete c;
- a_delete f;
- a_delete l;
+ a_delete (char *)c;
+ a_delete (char *)f;
+ a_delete (char *)l;
}
}
@@ -1797,7 +1797,7 @@
const char *replace_negate_str (const char *before, char *after)
{
if (before != NULL)
- a_delete before;
+ a_delete (char *)before;
if (strlen(after) > 0) {
int d = atoi(after);
@@ -1818,7 +1818,7 @@
const char *replace_str (const char *before, const char *after)
{
if (before != NULL)
- a_delete before;
+ a_delete (char *)before;
return after;
}
@@ -4725,7 +4725,7 @@
while ((s[i] != (char)0) && (s[i] != ',') && (s[i] != ']'))
i++;
if (i>0) {
- v = (char *)malloc(i+1);
+ v = new char[i+1];
memcpy(v, s, i+1);
v[i] = (char)0;
if (s[i] == ',')
Index: groff/src/devices/grolbp/lbp.h
diff -u groff/src/devices/grolbp/lbp.h:1.10 groff/src/devices/grolbp/lbp.h:1.11
--- groff/src/devices/grolbp/lbp.h:1.10 Mon Apr 19 06:17:42 2004
+++ groff/src/devices/grolbp/lbp.h Tue May 3 10:05:32 2005
@@ -1,5 +1,6 @@
// -*- C -*-
-/* Copyright (C) 1994, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 2000, 2001, 2003, 2004, 2005
+ Free Software Foundation, Inc.
Written by Francisco Andrés Verdú <address@hidden>
groff is free software; you can redistribute it and/or modify it under
@@ -28,14 +29,15 @@
static FILE *lbpoutput = NULL;
static FILE *vdmoutput = NULL;
+
static inline void
lbpinit(FILE *outfile)
{
lbpoutput = outfile;
-};
+}
-static inline void
+static void
lbpprintf(const char *format, ... )
{ /* Taken from cjet */
va_list stuff;
@@ -43,68 +45,78 @@
va_start(stuff, format);
vfprintf(lbpoutput, format, stuff);
va_end(stuff);
-};
+}
+
static inline void
lbpputs(const char *data)
{
fputs(data,lbpoutput);
-};
+}
+
static inline void
lbpputc(unsigned char c)
{
fputc(c,lbpoutput);
-};
+}
static inline void
lbpsavestatus(int idx )
{
fprintf(lbpoutput,"\033[%d%%y",idx);
-};
+}
+
static inline void
lbprestorestatus(int idx )
{
fprintf(lbpoutput,"\033[%d%cz",idx ,'%');
-};
+}
+
static inline void
lbpsavepos(int idx)
{
fprintf(lbpoutput,"\033[1;%d;0x",idx);
-};
+}
+
static inline void
lbprestorepos(int idx)
{
fprintf(lbpoutput,"\033[0;%d;0x",idx);
-};
+}
+
static inline void
lbprestoreposx(int idx)
{
fprintf(lbpoutput,"\033[0;%d;1x",idx);
-};
+}
+
static inline void
lbpmoverel(int despl, char direction)
{
fprintf(lbpoutput,"\033[%d%c",despl,direction);
-};
+}
+
static inline void
lbplinerel(int width,int despl,char direction )
{
fprintf(lbpoutput,"\033[%d;0;9{\033[%d%c\033[9}",width,despl,direction);
-};
+}
+
static inline void
lbpmoveabs(int x, int y)
{
fprintf(lbpoutput,"\033[%d;%df",y,x);
-};
+}
+
static inline void
lbplineto(int x,int y, int width )
@@ -112,7 +124,8 @@
fprintf(lbpoutput,"\033[%d;0;9{",width);
lbpmoveabs(x,y);
fprintf(lbpoutput,"\033[9}\n");
-};
+}
+
static inline void
lbpruleabs(int x, int y, int hsize, int vsize)
@@ -121,9 +134,11 @@
fprintf(lbpoutput,"\033[0;9;000s");
lbpmoveabs(x+hsize,y+vsize);
fprintf(lbpoutput,"\033[9r");
-};
+}
+
+
+static void vdmprintf(const char *format, ... );
-static inline void vdmprintf(const char *format, ... );
static inline char *
vdmnum(int num,char *result)
@@ -147,7 +162,8 @@
*p++ = b3;
*p = 0x00; /* End of the resulting string */
return result;
-};
+}
+
static inline void
vdmorigin(int newx, int newy)
@@ -155,7 +171,7 @@
char nx[4],ny[4];
vdmprintf("}\"%s%s\x1e",vdmnum(newx,nx),vdmnum(newy,ny));
-}; /* vdmorigin */
+}
static inline FILE *
@@ -170,15 +186,17 @@
vdmnum(-3,scale),vdmnum(1,size),vdmnum(1,lineend));
return vdmoutput;
-};
+}
+
static inline void
vdmend()
{
vdmprintf("}p\x1e");
-};
+}
-static inline void
+
+static void
vdmprintf(const char *format, ... )
{ /* Taken from cjet */
va_list stuff;
@@ -187,7 +205,8 @@
va_start(stuff, format);
vfprintf(vdmoutput, format, stuff);
va_end(stuff);
-};
+}
+
static inline void
vdmsetfillmode(int pattern,int perimeter, int inverted)
@@ -200,7 +219,8 @@
vdmprintf("I%s%s%s%s%s\x1e",vdmnum(pattern,patt),\
vdmnum(perimeter,perim),vdmnum(0,rot),
vdmnum(0,espejo),vdmnum(inverted,inv));
-};
+}
+
static inline void
vdmcircle(int centerx, int centery, int radius)
@@ -209,7 +229,8 @@
vdmprintf("5%s%s%s\x1e",vdmnum(centerx,x),vdmnum(centery,y),\
vdmnum(radius,rad));
-};
+}
+
static inline void
vdmaarc(int centerx, int centery, int radius,int startangle,int angle,int
style,int arcopen)
@@ -220,7 +241,8 @@
vdmnum(centerx,x),vdmnum(centery,y),\
vdmnum(radius,rad),vdmnum(startangle,stx),vdmnum(angle,sty),\
vdmnum(style,styl));
-};
+}
+
static inline void
vdmvarc(int centerx, int centery,int radius, int startx, int starty, int endx,
int endy,\
@@ -232,7 +254,8 @@
vdmnum(centerx,x),vdmnum(centery,y),\
vdmnum(radius,rad),vdmnum(startx,stx),vdmnum(starty,sty),\
vdmnum(endx,enx),vdmnum(endy,eny),vdmnum(style,styl));
-};
+}
+
static inline void
vdmellipse(int centerx, int centery, int radiusx, int radiusy,int rotation)
@@ -242,7 +265,8 @@
vdmprintf("}7%s%s%s%s%s\x1e\n",vdmnum(centerx,x),vdmnum(centery,y),\
vdmnum(radiusx,radx),vdmnum(radiusy,rady),\
vdmnum(rotation,rotat));
-};
+}
+
static inline void
vdmsetlinetype(int lintype)
@@ -251,7 +275,8 @@
vdmprintf("E1%s%s\x1e",vdmnum(lintype,ltyp),vdmnum(1,expfact));
-};
+}
+
static inline void
vdmsetlinestyle(int lintype, int pattern,int unionstyle)
@@ -265,7 +290,8 @@
vdmnum(pattern,patt),vdmnum(0,rot),
vdmnum(0,espejo),vdmnum(0,in));
vdmprintf("}F%s",vdmnum(unionstyle,rot));
-};
+}
+
static inline void
vdmlinewidth(int width)
@@ -273,7 +299,8 @@
char wh[4];
vdmprintf("F1%s\x1e",vdmnum(width,wh));
-};
+}
+
static inline void
vdmrectangle(int origx, int origy,int dstx, int dsty)
@@ -282,7 +309,8 @@
vdmprintf("}:%s%s%s%s\x1e\n",vdmnum(origx,xcoord),vdmnum(dstx,sdstx),\
vdmnum(origy,ycoord),vdmnum(dsty,sdsty));
-}; /* polyline */
+}
+
static inline void
vdmpolyline(int numpoints, int *points)
@@ -298,8 +326,9 @@
p += 2;
}; /* for */
vdmprintf("\x1e\n");
-}; /* polyline */
+}
+
static inline void
vdmpolygon(int numpoints, int *points)
{
@@ -315,7 +344,7 @@
}; /* for */
vdmprintf("\x1e\n");
-}; /* vdmpolygon */
+}
/************************************************************************
@@ -325,7 +354,7 @@
vdminited()
{
return (vdmoutput != NULL);
-}; /* vdminited */
+}
static inline void
@@ -340,7 +369,8 @@
vdmpolyline(2,points);
-};
+}
+
/*#define THRESHOLD .05 */ /* inch */
#define THRESHOLD 1 /* points (1/300 inch) */
@@ -401,7 +431,8 @@
lx = (int)px; ly = (int)py;
dxnew = dy = despx = despy = 0;
-}; /* splinerel */
+}
+
/**********************************************************************
* The following code to draw splines is adapted from the transfig package
@@ -437,7 +468,8 @@
((a_2+3.0*a_3)/4.0), ((b_2+3.0*b_3)/4.0),
((a_3+x_4)/2.0), ((b_3+y_4)/2.0), x_4, y_4);
};
-}; /* quadratic_spline */
+}
+
#define XCOORD(i) numbers[(2*i)]
#define YCOORD(i) numbers[(2*i)+1]
@@ -508,7 +540,7 @@
/* fprintf(tfp, "PA%.4f,%.4f;PU;\n", x_1, y_1);*/
-}; /* vdmspline */
+}
#endif
Index: groff/src/preproc/grn/main.cpp
diff -u groff/src/preproc/grn/main.cpp:1.3 groff/src/preproc/grn/main.cpp:1.4
--- groff/src/preproc/grn/main.cpp:1.3 Sat Apr 17 06:41:49 2004
+++ groff/src/preproc/grn/main.cpp Tue May 3 10:05:33 2005
@@ -214,7 +214,7 @@
void getres();
-char *doinput(FILE *fp);
+int doinput(FILE *fp);
void conv(register FILE *fp, int baseline);
void savestate();
int has_polygon(register ELT *elist);
@@ -317,7 +317,7 @@
} else
fp = stdin;
- while (doinput(fp) != NULL) {
+ while (doinput(fp)) {
if (*c1 == '.' && *c2 == 'G' && *c3 == 'S') {
if (compatibility_flag ||
*c4 == '\n' || *c4 == ' ' || *c4 == '\0')
@@ -391,7 +391,7 @@
/*----------------------------------------------------------------------------*
- | Routine: char * doinput (file_pointer)
+ | Routine: int doinput (file_pointer)
|
| Results: A line of input is read into `inputline'.
|
@@ -401,16 +401,14 @@
| updating `linenum'.
*----------------------------------------------------------------------------*/
-char *
+int
doinput(FILE *fp)
{
- char *k;
-
- if ((k = fgets(inputline, MAXINLINE, fp)) == NULL)
- return k;
+ if (fgets(inputline, MAXINLINE, fp) == NULL)
+ return 0;
if (strchr(inputline, '\n')) /* ++ only if it's a complete line */
linenum++;
- return (char *) !NULL;
+ return 1;
}
@@ -490,7 +488,7 @@
strcpy(GScommand, inputline); /* save `.GS' line for later */
do {
- done = (doinput(fp) == NULL); /* test for EOF */
+ done = !doinput(fp); /* test for EOF */
flyback = (*c3 == 'F'); /* and .GE or .GF */
compat = (compatibility_flag ||
*c4 == '\n' || *c4 == ' ' || *c4 == '\0');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff-commit] groff ./ChangeLog src/devices/grohtml/html-tabl...,
Werner LEMBERG <=