summaryrefslogtreecommitdiff
path: root/x2p/util.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1997-10-31 23:54:01 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1997-10-31 23:54:01 +0000
commitf0f333f45536802923a359d930d1dcfd5b4589ea (patch)
tree6f746f4b9cda56e2432754d6816467676c601820 /x2p/util.c
parent8ac853655d9b744749adcb9687c13d99cdd6e9fb (diff)
downloadperl-f0f333f45536802923a359d930d1dcfd5b4589ea.tar.gz
Further ANSI changes now builds and passes (most) tests
with gcc -x c++. p4raw-id: //depot/ansiperl@196
Diffstat (limited to 'x2p/util.c')
-rw-r--r--x2p/util.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/x2p/util.c b/x2p/util.c
index 469beb0c14..3d3b99a952 100644
--- a/x2p/util.c
+++ b/x2p/util.c
@@ -24,8 +24,7 @@ static char nomem[] = "Out of memory!\n";
Malloc_t
-safemalloc(size)
-MEM_SIZE size;
+safemalloc(size_t size)
{
Malloc_t ptr;
@@ -48,9 +47,7 @@ MEM_SIZE size;
/* paranoid version of realloc */
Malloc_t
-saferealloc(where,size)
-Malloc_t where;
-MEM_SIZE size;
+saferealloc(void *where, size_t size)
{
Malloc_t ptr;
@@ -74,8 +71,7 @@ MEM_SIZE size;
/* safe version of free */
Free_t
-safefree(where)
-Malloc_t where;
+safefree(void *where)
{
#ifdef DEBUGGING
if (debug & 128)
@@ -87,10 +83,7 @@ Malloc_t where;
/* safe version of string copy */
char *
-safecpy(to,from,len)
-char *to;
-register char *from;
-register int len;
+safecpy(char *to, register char *from, register int len)
{
register char *dest = to;
@@ -103,9 +96,7 @@ register int len;
/* copy a string up to some (non-backslashed) delimiter, if any */
char *
-cpytill(to,from,delim)
-register char *to, *from;
-register int delim;
+cpytill(register char *to, register char *from, register int delim)
{
for (; *from; from++,to++) {
if (*from == '\\') {
@@ -124,9 +115,7 @@ register int delim;
char *
-cpy2(to,from,delim)
-register char *to, *from;
-register int delim;
+cpy2(register char *to, register char *from, register int delim)
{
for (; *from; from++,to++) {
if (*from == '\\')
@@ -144,9 +133,7 @@ register int delim;
/* return ptr to little string in big string, NULL if not found */
char *
-instr(big, little)
-char *big, *little;
-
+instr(char *big, char *little)
{
register char *t, *s, *x;
@@ -166,10 +153,9 @@ char *big, *little;
/* copy a string to a safe spot */
char *
-savestr(str)
-char *str;
+savestr(char *str)
{
- register char *newaddr = safemalloc((MEM_SIZE)(strlen(str)+1));
+ register char *newaddr = (char *) safemalloc((MEM_SIZE)(strlen(str)+1));
(void)strcpy(newaddr,str);
return newaddr;
@@ -178,16 +164,13 @@ char *str;
/* grow a static string to at least a certain length */
void
-growstr(strptr,curlen,newlen)
-char **strptr;
-int *curlen;
-int newlen;
+growstr(char **strptr, int *curlen, int newlen)
{
if (newlen > *curlen) { /* need more room? */
if (*curlen)
- *strptr = saferealloc(*strptr,(MEM_SIZE)newlen);
+ *strptr = (char *) saferealloc(*strptr,(MEM_SIZE)newlen);
else
- *strptr = safemalloc((MEM_SIZE)newlen);
+ *strptr = (char *) safemalloc((MEM_SIZE)newlen);
*curlen = newlen;
}
}