summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-11 17:01:18 +0000
committerKarl Berry <karl@freefriends.org>2010-04-11 17:01:18 +0000
commit1af131813889d805683c82542c50a9ae5b9abc26 (patch)
treeafed16764541f426995bac9b86e261568727907a /Build/source
parent412f83e27b51d4235fa69c5964263bdadb6b681f (diff)
remove redundant casts of xmalloc return
git-svn-id: svn://tug.org/texlive/trunk@17803 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog9
-rw-r--r--Build/source/texk/web2c/lib/basechsuffix.c2
-rw-r--r--Build/source/texk/web2c/lib/chartostring.c2
-rw-r--r--Build/source/texk/web2c/lib/openclose.c10
-rw-r--r--Build/source/texk/web2c/lib/printversion.c2
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c33
6 files changed, 34 insertions, 24 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index f7cb3ca6936..a7575ab8083 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,12 @@
+2010-04-11 Karl Berry <karl@tug.org>
+
+ * texmfmp.c,
+ * printversion.c,
+ * openclose.c,
+ * chartostring.c,
+ * basechsuffix.c: remove useless casts to (string) or (char *),
+ etc. of xmalloc.
+
2010-03-30 Peter Breitenlohner <peb@mppmu.mpg.de>
* openclose.c (open_input): Fixed a typo.
diff --git a/Build/source/texk/web2c/lib/basechsuffix.c b/Build/source/texk/web2c/lib/basechsuffix.c
index 8ca0e7cb117..2b1e9554eab 100644
--- a/Build/source/texk/web2c/lib/basechsuffix.c
+++ b/Build/source/texk/web2c/lib/basechsuffix.c
@@ -34,7 +34,7 @@ basenamechangesuffix (const_string name, const_string old_suffix,
}
}
- answer = (string)xmalloc (copy_limit + strlen (new_suffix) + 1);
+ answer = xmalloc (copy_limit + strlen (new_suffix) + 1);
strncpy (answer, base, copy_limit);
answer[copy_limit] = 0;
strcat (answer, new_suffix);
diff --git a/Build/source/texk/web2c/lib/chartostring.c b/Build/source/texk/web2c/lib/chartostring.c
index bd4253022cd..fe3b88d52d1 100644
--- a/Build/source/texk/web2c/lib/chartostring.c
+++ b/Build/source/texk/web2c/lib/chartostring.c
@@ -16,7 +16,7 @@ Written in 1994 by Karl Berry. Public domain. */
string
chartostring (char ch)
{
- string str = (string)xmalloc (2);
+ string str = xmalloc (2);
str[0] = ch;
str[1] = 0;
return str;
diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c
index 1d21476b2b1..4107ce70ca9 100644
--- a/Build/source/texk/web2c/lib/openclose.c
+++ b/Build/source/texk/web2c/lib/openclose.c
@@ -1,6 +1,6 @@
/* openclose.c: open and close files for TeX, Metafont, and BibTeX.
- Written 1995, 96 Karl Berry. Public domain. */
+ Written 1995 Karl Berry. Public domain. */
#include "config.h"
#include "lib.h"
@@ -47,7 +47,7 @@ recorder_start(void)
char pid_str[MAX_INT_LENGTH];
sprintf (pid_str, "%ld", (long) pid);
- recorder_name = (string)xmalloc(strlen(kpse_program_name)
+ recorder_name = xmalloc(strlen(kpse_program_name)
+ strlen (pid_str) + 5);
strcpy(recorder_name, kpse_program_name);
strcat(recorder_name, pid_str);
@@ -139,7 +139,7 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode)
if (*f_ptr) {
free (nameoffile);
namelength = strlen (fname);
- nameoffile = (string) xmalloc (namelength + 2);
+ nameoffile = xmalloc (namelength + 2);
strcpy (nameoffile + 1, fname);
fullnameoffile = fname;
} else {
@@ -186,7 +186,7 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode)
/* kpse_find_file always returns a new string. */
free (nameoffile);
namelength = strlen (fname);
- nameoffile = (string)xmalloc (namelength + 2);
+ nameoffile = xmalloc (namelength + 2);
strcpy (nameoffile + 1, fname);
free (fname);
@@ -257,7 +257,7 @@ open_output (FILE **f_ptr, const_string fopen_mode)
if (fname != nameoffile + 1) {
free (nameoffile);
namelength = strlen (fname);
- nameoffile = (string)xmalloc (namelength + 2);
+ nameoffile = xmalloc (namelength + 2);
strcpy (nameoffile + 1, fname);
}
recorder_record_output (fname);
diff --git a/Build/source/texk/web2c/lib/printversion.c b/Build/source/texk/web2c/lib/printversion.c
index bb9874b5244..2cfb751d58f 100644
--- a/Build/source/texk/web2c/lib/printversion.c
+++ b/Build/source/texk/web2c/lib/printversion.c
@@ -31,7 +31,7 @@ printversionandexit (const_string banner,
prog_version++;
len = prog_name_end - banner - sizeof ("This is");
- prog_name = (string)xmalloc (len + 1);
+ prog_name = xmalloc (len + 1);
strncpy (prog_name, banner + sizeof ("This is"), len);
prog_name[len] = 0;
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index cfef8fc2ba5..796531ce0b1 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -158,12 +158,12 @@ mk_shellcmdlist (const char *v)
}
if (*q)
n++;
- cmdlist = (char **) xmalloc ((n + 1) * sizeof (char *));
+ cmdlist = xmalloc ((n + 1) * sizeof (char *));
p = cmdlist;
q = v;
while ((r = strchr (q, ',')) != 0) {
*r = '\0';
- *p = (char *) xmalloc (strlen (q) + 1);
+ *p = xmalloc (strlen (q) + 1);
strcpy (*p, q);
*r = ',';
r++;
@@ -171,7 +171,7 @@ mk_shellcmdlist (const char *v)
p++;
}
if (*q) {
- *p = (char *) xmalloc (strlen (q) + 1);
+ *p = xmalloc (strlen (q) + 1);
strcpy (*p, q);
p++;
*p = NULL;
@@ -277,7 +277,7 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
/* pre == 1 means that the previous character is a white space
pre == 0 means that the previous character is not a white space */
- buf = (char *) xmalloc (strlen (cmd) + 1);
+ buf = xmalloc (strlen (cmd) + 1);
strcpy (buf, cmd);
c = buf;
while (Isspace (*c))
@@ -317,9 +317,9 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
/* allocate enough memory (too much?) */
#ifdef WIN32
- *safecmd = (char *) xmalloc (2 * strlen (cmd) + 3 + 2 * spaces);
+ *safecmd = xmalloc (2 * strlen (cmd) + 3 + 2 * spaces);
#else
- *safecmd = (char *) xmalloc (strlen (cmd) + 3 + 2 * spaces);
+ *safecmd = xmalloc (strlen (cmd) + 3 + 2 * spaces);
#endif
/* make a safe command line *safecmd */
@@ -1059,7 +1059,7 @@ ipcpage (int is_eof)
len = strstartar[outputfilename + 1 - 65536L] -
strstartar[outputfilename - 65536L];
#endif
- name = (string)xmalloc (len + 1);
+ name = xmalloc (len + 1);
#if !defined(Aleph)
strncpy (name, (string)&strpool[strstart[outputfilename]], len);
#else
@@ -1218,7 +1218,7 @@ normalize_quotes (const_string name, const_string mesg)
len += 2; /* this could sometimes add length we don't need */
}
}
- ret = (string)xmalloc(len + 1);
+ ret = xmalloc(len + 1);
p = ret;
if (must_quote) {
if (quote_char == 0)
@@ -1247,7 +1247,7 @@ normalize_quotes (const_string name, const_string mesg)
boolean quoted = false;
boolean must_quote = (strchr(name, ' ') != NULL);
/* Leave room for quotes and NUL. */
- string ret = (string)xmalloc(strlen(name)+3);
+ string ret = xmalloc(strlen(name)+3);
string p;
const_string q;
p = ret;
@@ -1449,7 +1449,7 @@ parse_options (int argc, string *argv)
} else {
WARNING2 ("Comment truncated to 255 characters from %d. (%s)",
len, optarg);
- outputcomment = (string) xmalloc (256);
+ outputcomment = xmalloc (256);
strncpy (outputcomment, optarg, 255);
outputcomment[255] = 0;
}
@@ -1723,7 +1723,7 @@ open_in_or_pipe (FILE **f_ptr, int filefmt, const_string fopen_mode)
if (shellenabledp && *(nameoffile+1) == '|') {
/* the user requested a pipe */
*f_ptr = NULL;
- fname = (string)xmalloc(strlen((const_string)(nameoffile+1))+1);
+ fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
strcpy(fname,(const_string)(nameoffile+1));
#if !defined(pdfTeX)
if (fullnameoffile)
@@ -1740,7 +1740,7 @@ open_in_or_pipe (FILE **f_ptr, int filefmt, const_string fopen_mode)
}
}
if (*f_ptr)
- setvbuf (*f_ptr,(char *)NULL,_IOLBF,0);
+ setvbuf (*f_ptr,NULL,_IOLBF,0);
return *f_ptr != NULL;
}
@@ -1763,7 +1763,7 @@ open_out_or_pipe (FILE **f_ptr, const_string fopen_mode)
if (shellenabledp && *(nameoffile+1) == '|') {
/* the user requested a pipe */
- fname = (string)xmalloc(strlen((const_string)(nameoffile+1))+1);
+ fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
strcpy(fname,(const_string)(nameoffile+1));
if (strchr (fname,' ')==NULL && strchr(fname,'>')==NULL) {
/* mp and mf currently do not use this code, but it
@@ -1786,7 +1786,7 @@ open_out_or_pipe (FILE **f_ptr, const_string fopen_mode)
}
if (*f_ptr)
- setvbuf(*f_ptr,(char *)NULL,_IOLBF,0);
+ setvbuf(*f_ptr,NULL,_IOLBF,0);
return *f_ptr != NULL;
}
@@ -2038,7 +2038,7 @@ calledit (packedASCIIcode *filename,
/* Construct the command string. The `11' is the maximum length an
integer might be. */
- command = (string) xmalloc (strlen (edit_value) + fnlength + 11);
+ command = xmalloc (strlen (edit_value) + fnlength + 11);
/* So we can construct it as we go. */
temp = command;
@@ -2339,7 +2339,8 @@ gettexstring (strnumber s)
poolpointer len, i, j;
string name;
len = strstart[s + 1 - 65536L] - strstart[s - 65536L];
- name = (string)xmalloc(len * 3 + 1); /* max UTF16->UTF8 expansion (code units, not bytes) */
+ name = xmalloc(len * 3 + 1); /* max UTF16->UTF8 expansion
+ (code units, not bytes) */
for (i = 0, j = 0; i < len; i++) {
unsigned c = strpool[i + strstart[s - 65536L]];
if (c >= 0xD800 && c <= 0xDBFF) {