summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-07-16 02:08:50 +0000
committerwlemb <wlemb>2001-07-16 02:08:50 +0000
commited2739e96cfdf6df4d48981ba246cdcf1d194933 (patch)
treee1a0d9491dafce4d244e2fa11bf53d820aff0923
parentd58bbd890f081115ff75d4eb4539ea45b6634f3e (diff)
downloadgroff-ed2739e96cfdf6df4d48981ba246cdcf1d194933.tar.gz
Replace strdup() with strsave().
* src/devices/grolbp/lbp.cc [!HAVE_STRDUP]: Removed. (set_papersize): Use strsave() and a_delete. (main): Use strsave(). * src/preproc/html/pre-html.cc (make_message, createAllPages, removeAllPages): Use strsave() and a_delete. * configure.ac: Remove test for strdup. * configure: Regenerated. * win32-diffs: Updated.
-rw-r--r--ChangeLog17
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--src/devices/grolbp/lbp.cc25
-rw-r--r--src/preproc/html/pre-html.cc27
-rw-r--r--win32-diffs6
6 files changed, 37 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index ed46b896..597734c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2001-07-16 Werner LEMBERG <wl@gnu.org>
+
+ Replace strdup() with strsave().
+
+ * src/devices/grolbp/lbp.cc [!HAVE_STRDUP]: Removed.
+ (set_papersize): Use strsave() and a_delete.
+ (main): Use strsave().
+ * src/preproc/html/pre-html.cc (make_message, createAllPages,
+ removeAllPages): Use strsave() and a_delete.
+
+ * configure.ac: Remove test for strdup.
+ * configure: Regenerated.
+
+2001-07-15 Werner LEMBERG <wl@gnu.org>
+
+ * win32-diffs: Updated.
+
2001-07-14 Werner LEMBERG <wl@gnu.org>
* src/preproc/html/pre-html.cc (makeTempFiles): Activate new code,
diff --git a/configure b/configure
index e5b65803..9980963f 100755
--- a/configure
+++ b/configure
@@ -3945,7 +3945,7 @@ done
LIBS="$saved_libs"
-for ac_func in rename strcasecmp strncasecmp strsep strdup
+for ac_func in rename strcasecmp strncasecmp strsep
do
ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh`
echo "$as_me:3951: checking for $ac_func" >&5
diff --git a/configure.ac b/configure.ac
index b8f111a0..ed6c9a62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ saved_libs="$LIBS"
LIBS="$LIBS -lc $LIBM"
AC_REPLACE_FUNCS(fmod strtol getcwd strerror putenv)
LIBS="$saved_libs"
-AC_CHECK_FUNCS(rename strcasecmp strncasecmp strsep strdup)
+AC_CHECK_FUNCS(rename strcasecmp strncasecmp strsep)
GROFF_MKSTEMP
AC_DECL_SYS_SIGLIST
dnl checks for compiler characteristics
diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc
index ec8c7b1f..376324b6 100644
--- a/src/devices/grolbp/lbp.cc
+++ b/src/devices/grolbp/lbp.cc
@@ -98,19 +98,6 @@ static char *strsep(char **pcadena, const char *delim)
};
#endif
-#ifndef HAVE_STRDUP
-// Ditto with OS/390 and strdup
-static char *strdup(const char *s)
-{
- char *result;
-
- result = (char *)malloc(strlen(s)+1);
- if (result != NULL) strcpy(result,s);
- return result;
-
-}; // strdup
-
-#endif
lbp_font::lbp_font(const char *nm)
: font(nm)
{
@@ -580,20 +567,20 @@ static int set_papersize(const char *papersize)
*p1,
*papsize;
- p = papsize = strdup(&papersize[4]);
+ p = papsize = strsave(&papersize[4]);
if (papsize == NULL) return -1;
p1 = strsep(&p,"x");
if (p == NULL)
{ // let's test for an uppercase x
p = papsize ;
p1 = strsep(&p,"X");
- if (p == NULL) { free(papsize); return -1;};
+ if (p == NULL) { a_delete papsize; return -1;};
}; // if (p1 == NULL)
paperlength = atoi(p1);
- if (paperlength == 0) { free(papsize); return -1;};
+ if (paperlength == 0) { a_delete papsize; return -1;};
paperwidth = atoi(p);
- if (paperwidth == 0) { free(papsize); return -1;};
- free(papsize);
+ if (paperwidth == 0) { a_delete papsize; return -1;};
+ a_delete papsize;
return 82;
}; // if (strcnasecmp("cust",papersize,4) == 0)
@@ -692,7 +679,7 @@ static void usage(FILE *stream)
int main(int argc, char **argv)
{
- if (program_name == NULL) program_name = strdup(argv[0]);
+ if (program_name == NULL) program_name = strsave(argv[0]);
font::set_unknown_desc_command_handler(handle_unknown_desc_command);
// command line parsing
diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc
index b4b3ea3d..dcb234f4 100644
--- a/src/preproc/html/pre-html.cc
+++ b/src/preproc/html/pre-html.cc
@@ -190,9 +190,7 @@ make_message (const char *fmt, ...)
/* If that worked, return the string. */
if (n > -1 && n < size) {
if (size > n+1) {
- np = strdup(p);
- if (np == NULL)
- sys_fatal("strdup");
+ np = strsave(p);
free(p);
return np;
}
@@ -268,7 +266,7 @@ intToStr (int i)
char *
make_message (const char *fmt, ...)
{
- char *p = strdup(fmt); /* so we can splat a nul anywhere in the string */
+ char *p = strsave(fmt); /* so we can splat a nul anywhere in the string */
char *np;
char *l;
char *s;
@@ -276,9 +274,6 @@ make_message (const char *fmt, ...)
int search=0;
va_list ap;
- if (p == NULL)
- sys_fatal("strdup");
-
va_start(ap, fmt);
while (p) {
int lenp=strlen(p);
@@ -294,9 +289,7 @@ make_message (const char *fmt, ...)
switch (*(f+1)) {
case 'd':
- l = strdup(f+2);
- if (l == NULL)
- sys_fatal("strdup");
+ l = strsave(f+2);
*f = (char)0;
num = intToStr(va_arg(ap, int));
np = (char *)malloc(strlen(p)+strlen(num)+strlen(l)+1);
@@ -307,13 +300,11 @@ make_message (const char *fmt, ...)
strcat(np, l);
search += strlen(np)-lenp;
free(num);
- free(l);
+ a_delete l;
break;
case 's':
/* concat */
l = f+2;
- if (l == NULL)
- sys_fatal("strdup");
s = va_arg(ap, char *);
*f = (char)0;
np = (char *)malloc(strlen(l)+1+strlen(p)+strlen(s));
@@ -339,7 +330,7 @@ make_message (const char *fmt, ...)
sys_fatal("unexpected format specifier");
return NULL;
}
- free(p);
+ a_delete p;
p = np;
}
va_end(ap);
@@ -507,7 +498,7 @@ static void makeFileName (void)
sys_fatal("malloc");
strcpy(image_template, s);
strcat(image_template, "-%d");
- free(s);
+ a_delete s;
}
/*
@@ -890,7 +881,7 @@ static int createAllPages (void)
fflush(stderr);
#endif
html_system(s, 1);
- free(s);
+ a_delete s;
return 0;
}
@@ -906,7 +897,7 @@ static void removeAllPages (void)
do {
if (s)
- free(s);
+ a_delete s;
s = make_message("%s/%d", imagePageStem, i);
if (s == NULL)
sys_fatal("make_message");
@@ -970,7 +961,7 @@ static void createImage (imageItem *i)
fprintf(stderr, s);
#endif
html_system(s, 0);
- free(s);
+ a_delete s;
#if defined(DEBUGGING)
} else {
fprintf(stderr, "ignoring image as x1 coord is -1\n");
diff --git a/win32-diffs b/win32-diffs
index d6644007..3d61f3e6 100644
--- a/win32-diffs
+++ b/win32-diffs
@@ -2891,8 +2891,8 @@ diff -aruN groff/src/libs/libgroff/version.cc groff.win32/src/libs/libgroff/vers
+++ groff.win32/src/libs/libgroff/version.cc Wed May 17 08:57:48 2000
@@ -0,0 +1,3 @@
+const char *version_string = "1.17";
-+const char *revision_string = "1";
-+extern "C" const char *Version_string = "1.17.1";
++const char *revision_string = "3";
++extern "C" const char *Version_string = "1.17.3";
diff -aruN groff/src/preproc/eqn/Makefile.msc groff.win32/src/preproc/eqn/Makefile.msc
--- groff/src/preproc/eqn/Makefile.msc Thu Jan 1 00:00:00 1970
+++ groff.win32/src/preproc/eqn/Makefile.msc Wed May 17 08:57:48 2000
@@ -3045,4 +3045,4 @@ diff -aruN groff/src/roff/troff/majorminor.cc groff.win32/src/roff/troff/majormi
@@ -0,0 +1,3 @@
+const char *major_version = "1";
+const char *minor_version = "17";
-+const char *revision = "1";
++const char *revision = "3";