Mercurial > emacs
comparison lib-src/etags.c @ 11673:46d2178719ad
(C_entries): Cast result of xrealloc.
(xmalloc, xrealloc): Declare them to return long *.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 04 May 1995 06:46:14 +0000 |
parents | 3cf67df24e7f |
children | c5db1295f7df |
comparison
equal
deleted
inserted
replaced
11672:5c0492c6c2e4 | 11673:46d2178719ad |
---|---|
137 char *concat (); | 137 char *concat (); |
138 char *savenstr (), *savestr (); | 138 char *savenstr (), *savestr (); |
139 char *etags_strchr (), *etags_strrchr (); | 139 char *etags_strchr (), *etags_strrchr (); |
140 char *etags_getcwd (); | 140 char *etags_getcwd (); |
141 char *relative_filename (), *absolute_filename (), *absolute_dirname (); | 141 char *relative_filename (), *absolute_filename (), *absolute_dirname (); |
142 char *xmalloc (), *xrealloc (); | 142 long *xmalloc (), *xrealloc (); |
143 | 143 |
144 typedef void Lang_function (); | 144 typedef void Lang_function (); |
145 #if FALSE /* many compilers barf on this */ | 145 #if FALSE /* many compilers barf on this */ |
146 Lang_function Asm_labels; | 146 Lang_function Asm_labels; |
147 Lang_function default_C_entries; | 147 Lang_function default_C_entries; |
2066 { | 2066 { |
2067 int strsize = strlen(structtag) + 2 + toklen + 1; | 2067 int strsize = strlen(structtag) + 2 + toklen + 1; |
2068 while (token_name.size < strsize) | 2068 while (token_name.size < strsize) |
2069 { | 2069 { |
2070 token_name.size *= 2; | 2070 token_name.size *= 2; |
2071 token_name.buffer=xrealloc(token_name.buffer, | 2071 token_name.buffer |
2072 token_name.size); | 2072 = (char *) xrealloc (token_name.buffer, |
2073 token_name.size); | |
2073 } | 2074 } |
2074 strcpy (token_name.buffer, structtag); | 2075 strcpy (token_name.buffer, structtag); |
2075 strcat (token_name.buffer, "::"); | 2076 strcat (token_name.buffer, "::"); |
2076 strncat (token_name.buffer, | 2077 strncat (token_name.buffer, |
2077 newlb.buffer+tokoff, toklen); | 2078 newlb.buffer+tokoff, toklen); |
2080 else | 2081 else |
2081 { | 2082 { |
2082 while (token_name.size < toklen + 1) | 2083 while (token_name.size < toklen + 1) |
2083 { | 2084 { |
2084 token_name.size *= 2; | 2085 token_name.size *= 2; |
2085 token_name.buffer=xrealloc(token_name.buffer, | 2086 token_name.buffer |
2086 token_name.size); | 2087 = (char *) xrealloc (token_name.buffer, |
2088 token_name.size); | |
2087 } | 2089 } |
2088 strncpy (token_name.buffer, | 2090 strncpy (token_name.buffer, |
2089 newlb.buffer+tokoff, toklen); | 2091 newlb.buffer+tokoff, toklen); |
2090 token_name.buffer[toklen] = '\0'; | 2092 token_name.buffer[toklen] = '\0'; |
2091 if (structdef == stagseen | 2093 if (structdef == stagseen |
3812 | 3814 |
3813 return res; | 3815 return res; |
3814 } | 3816 } |
3815 | 3817 |
3816 /* Like malloc but get fatal error if memory is exhausted. */ | 3818 /* Like malloc but get fatal error if memory is exhausted. */ |
3817 char * | 3819 long * |
3818 xmalloc (size) | 3820 xmalloc (size) |
3819 unsigned int size; | 3821 unsigned int size; |
3820 { | 3822 { |
3821 char *result = (char *) malloc (size); | 3823 long *result = (long *) malloc (size); |
3822 if (result == NULL) | 3824 if (result == NULL) |
3823 fatal ("virtual memory exhausted", 0); | 3825 fatal ("virtual memory exhausted", 0); |
3824 return result; | 3826 return result; |
3825 } | 3827 } |
3826 | 3828 |
3827 char * | 3829 long * |
3828 xrealloc (ptr, size) | 3830 xrealloc (ptr, size) |
3829 char *ptr; | 3831 char *ptr; |
3830 unsigned int size; | 3832 unsigned int size; |
3831 { | 3833 { |
3832 char *result = (char *) realloc (ptr, size); | 3834 long *result = (long *) realloc (ptr, size); |
3833 if (result == NULL) | 3835 if (result == NULL) |
3834 fatal ("virtual memory exhausted"); | 3836 fatal ("virtual memory exhausted"); |
3835 return result; | 3837 return result; |
3836 } | 3838 } |