mjs@MENTOR.CC.PURDUE.EDU (Mike Spitzer) (01/08/89)
Etags.c claims that malloc() and realloc() return ints; this is not
the case. It happens to work most places, but not on machines such as
the ETA-10P where pointers != ints. Here are the diffs for etags.c.
I moved xmalloc and xrealloc up in the file so that they wouldn't have
to be externed.
I'm in the process of porting Emacs to the ETA-10P (one of CDC/ETA's
new supercomputers running native System V Unix), but haven't gotten
very far. Is there any chance of emacs running on a machine where
ints and pointers can't be used interchangeably?
Mike Spitzer
Purdue University Computing Center Unix Group
*** /tmp/,RCSt1a12790 Sat Jan 7 18:58:19 1989
--- /userb/mjs/dist-18.52/etc/etags.c Sat Jan 7 15:30:54 1989
***************
*** 548,553 ****
--- 548,578 ----
fclose(inf);
}
+ /* Like malloc but get fatal error if memory is exhausted. */
+
+ char *
+ xmalloc (size)
+ int size;
+ {
+ extern char *malloc();
+ char *result = malloc (size);
+ if (result == (char *) 0)
+ fatal ("virtual memory exhausted", 0);
+ return result;
+ }
+
+ char *
+ xrealloc (ptr, size)
+ char *ptr;
+ int size;
+ {
+ extern char *realloc();
+ char *result = realloc (ptr, size);
+ if (result == (char *) 0)
+ fatal ("virtual memory exhausted");
+ return result;
+ }
+
/* Record a tag on the current line.
name is the tag name,
f is nonzero to use a pattern, zero to use line number instead. */
***************
*** 564,569 ****
--- 589,595 ----
register NODE *np;
char *altname;
char tem[51];
+ extern char *malloc();
if ((np = (NODE *) malloc (sizeof (NODE))) == NULL)
{
***************
*** 1662,1689 ****
strcpy (result + len1 + len2, s3);
*(result + len1 + len2 + len3) = 0;
- return result;
- }
-
- /* Like malloc but get fatal error if memory is exhausted. */
-
- int
- xmalloc (size)
- int size;
- {
- int result = malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
- }
-
- int
- xrealloc (ptr, size)
- char *ptr;
- int size;
- {
- int result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
return result;
}