Changeset 609 for branches/GNU/src/binutils/libiberty/cplus-dem.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/libiberty/cplus-dem.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Demangler for GNU C++ 2 2 Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000 Free Software Foundation, Inc.3 2000, 2001 Free Software Foundation, Inc. 4 4 Written by James Clark (jjc@jclark.uucp) 5 5 Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling … … 11 11 License as published by the Free Software Foundation; either 12 12 version 2 of the License, or (at your option) any later version. 13 14 In addition to the permissions in the GNU Library General Public 15 License, the Free Software Foundation gives you unlimited permission 16 to link the compiled version of this file into combinations with other 17 programs, and to distribute those combinations without any restriction 18 coming from the use of this file. (The Library Public License 19 restrictions do apply in other respects; for example, they cover 20 modification of the file, and distribution when not linked into a 21 combined executable.) 13 22 14 23 Libiberty is distributed in the hope that it will be useful, … … 63 72 64 73 extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; 65 66 static const char *mystrstr PARAMS ((const char *, const char *));67 68 static const char *69 mystrstr (s1, s2)70 const char *s1, *s2;71 {72 register const char *p = s1;73 register int len = strlen (s2);74 75 for (; (p = strchr (p, *s2)) != 0; p++)76 {77 if (strncmp (p, s2, len) == 0)78 {79 return (p);80 }81 }82 return (0);83 }84 74 85 75 /* In order to allow a single demangler executable to demangle strings … … 158 148 static const struct optable 159 149 { 160 const char * in;161 const char * out;162 int flags;150 const char *const in; 151 const char *const out; 152 const int flags; 163 153 } optable[] = { 164 154 {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */ … … 257 247 } type_kind_t; 258 248 259 struct demangler_engine libiberty_demanglers[] = 260 { 249 const struct demangler_engine libiberty_demanglers[] = 250 { 251 { 252 NO_DEMANGLING_STYLE_STRING, 253 no_demangling, 254 "Demangling disabled" 255 } 256 , 261 257 { 262 258 AUTO_DEMANGLING_STYLE_STRING, … … 319 315 320 316 #define STRING_EMPTY(str) ((str) -> b == (str) -> p) 321 #define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \322 string_prepend(str, " ");}323 317 #define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ 324 318 string_append(str, " ");} … … 530 524 531 525 static void 532 grow_vect PARAMS (( void**, size_t *, size_t, int));526 grow_vect PARAMS ((char **, size_t *, size_t, int)); 533 527 534 528 /* Translate count to integer, consuming tokens in the process. … … 568 562 (*type)++; 569 563 } 564 565 if (count < 0) 566 count = -1; 570 567 571 568 return (count); … … 848 845 enum demangling_styles style; 849 846 { 850 struct demangler_engine *demangler = libiberty_demanglers;847 const struct demangler_engine *demangler = libiberty_demanglers; 851 848 852 849 for (; demangler->demangling_style != unknown_demangling; ++demangler) … … 866 863 const char *name; 867 864 { 868 struct demangler_engine *demangler = libiberty_demanglers;865 const struct demangler_engine *demangler = libiberty_demanglers; 869 866 870 867 for (; demangler->demangling_style != unknown_demangling; ++demangler) … … 878 875 879 876 If MANGLED is a mangled function name produced by GNU C++, then 880 a pointer to a malloced string giving a C++ representation877 a pointer to a @code{malloc}ed string giving a C++ representation 881 878 of the name will be returned; otherwise NULL will be returned. 882 879 It is the caller's responsibility to free the string which … … 910 907 char *ret; 911 908 struct work_stuff work[1]; 909 910 if (current_demangling_style == no_demangling) 911 return xstrdup (mangled); 912 912 913 memset ((char *) work, 0, sizeof (work)); 913 914 work->options = options; … … 918 919 if (GNU_V3_DEMANGLING || AUTO_DEMANGLING) 919 920 { 920 ret = cplus_demangle_v3 (mangled );921 ret = cplus_demangle_v3 (mangled, work->options); 921 922 if (ret || GNU_V3_DEMANGLING) 922 923 return ret; 924 } 925 926 if (JAVA_DEMANGLING) 927 { 928 ret = java_demangle_v3 (mangled); 929 if (ret) 930 return ret; 923 931 } 924 932 … … 938 946 static void 939 947 grow_vect (old_vect, size, min_size, element_size) 940 void**old_vect;948 char **old_vect; 941 949 size_t *size; 942 950 size_t min_size; … … 948 956 if (*size < min_size) 949 957 *size = min_size; 950 *old_vect = xrealloc (*old_vect, *size * element_size);958 *old_vect = (void *) xrealloc (*old_vect, *size * element_size); 951 959 } 952 960 } … … 971 979 int at_start_name; 972 980 int changed; 973 char *demangling_buffer = NULL; 974 size_t demangling_buffer_size = 0; 981 size_t demangled_size = 0; 975 982 976 983 changed = 0; … … 1000 1007 1001 1008 /* Make demangled big enough for possible expansion by operator name. */ 1002 grow_vect ( (void **) &(demangling_buffer),1003 &demangl ing_buffer_size, 2 * len0 + 1,1009 grow_vect (&demangled, 1010 &demangled_size, 2 * len0 + 1, 1004 1011 sizeof (char)); 1005 demangled = demangling_buffer;1006 1012 1007 1013 if (ISDIGIT ((unsigned char) mangled[len0 - 1])) { … … 1053 1059 1054 1060 Suppress: 1055 grow_vect ( (void **) &(demangling_buffer),1056 &demangl ing_buffer_size, strlen (mangled) + 3,1061 grow_vect (&demangled, 1062 &demangled_size, strlen (mangled) + 3, 1057 1063 sizeof (char)); 1058 demangled = demangling_buffer; 1064 1059 1065 if (mangled[0] == '<') 1060 1066 strcpy (demangled, mangled); … … 1068 1074 to be able to demangle a name with a B, K or n code, we need to 1069 1075 have a longer term memory of what types have been seen. The original 1070 now in tializes and cleans up the squangle code info, while internal1076 now initializes and cleans up the squangle code info, while internal 1071 1077 calls go directly to this routine to avoid resetting that info. */ 1072 1078 … … 1208 1214 if (from->ntmpl_args) 1209 1215 to->tmpl_argvec 1210 = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));1216 = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); 1211 1217 1212 1218 for (i = 0; i < from->ntmpl_args; i++) … … 1433 1439 string_append (&s, SCOPE_STRING (work)); 1434 1440 string_prepends (declp, &s); 1441 string_delete (&s); 1435 1442 } 1436 1443 oldmangled = NULL; … … 1512 1519 /* Read the return type. */ 1513 1520 string return_type; 1514 string_init (&return_type);1515 1521 1516 1522 (*mangled)++; … … 1787 1793 /* By default, we let the number decide whether we shall consume an 1788 1794 underscore. */ 1789 int consume_following_underscore = 0;1795 int multidigit_without_leading_underscore = 0; 1790 1796 int leave_following_underscore = 0; 1791 1797 1792 1798 success = 0; 1793 1799 1794 /* Negative numbers are indicated with a leading `m'. */ 1795 if (**mangled == 'm') 1796 { 1797 string_appendn (s, "-", 1); 1798 (*mangled)++; 1799 } 1800 else if (mangled[0][0] == '_' && mangled[0][1] == 'm') 1801 { 1802 /* Since consume_count_with_underscores does not handle the 1803 `m'-prefix we must do it here, using consume_count and 1804 adjusting underscores: we have to consume the underscore 1805 matching the prepended one. */ 1806 consume_following_underscore = 1; 1807 string_appendn (s, "-", 1); 1808 (*mangled) += 2; 1809 } 1810 else if (**mangled == '_') 1811 { 1812 /* Do not consume a following underscore; 1813 consume_following_underscore will consume what should be 1814 consumed. */ 1800 if (**mangled == '_') 1801 { 1802 if (mangled[0][1] == 'm') 1803 { 1804 /* Since consume_count_with_underscores does not handle the 1805 `m'-prefix we must do it here, using consume_count and 1806 adjusting underscores: we have to consume the underscore 1807 matching the prepended one. */ 1808 multidigit_without_leading_underscore = 1; 1809 string_appendn (s, "-", 1); 1810 (*mangled) += 2; 1811 } 1812 else 1813 { 1814 /* Do not consume a following underscore; 1815 consume_count_with_underscores will consume what 1816 should be consumed. */ 1817 leave_following_underscore = 1; 1818 } 1819 } 1820 else 1821 { 1822 /* Negative numbers are indicated with a leading `m'. */ 1823 if (**mangled == 'm') 1824 { 1825 string_appendn (s, "-", 1); 1826 (*mangled)++; 1827 } 1828 /* Since consume_count_with_underscores does not handle 1829 multi-digit numbers that do not start with an underscore, 1830 and this number can be an integer template parameter, 1831 we have to call consume_count. */ 1832 multidigit_without_leading_underscore = 1; 1833 /* These multi-digit numbers never end on an underscore, 1834 so if there is one then don't eat it. */ 1815 1835 leave_following_underscore = 1; 1816 1836 } … … 1820 1840 the leading underscore (that we consumed) if it is to handle 1821 1841 multi-digit numbers. */ 1822 if ( consume_following_underscore)1842 if (multidigit_without_leading_underscore) 1823 1843 value = consume_count (mangled); 1824 1844 else … … 1838 1858 underscore, we need to do something more radical. */ 1839 1859 1840 if ((value > 9 || consume_following_underscore)1860 if ((value > 9 || multidigit_without_leading_underscore) 1841 1861 && ! leave_following_underscore 1842 1862 && **mangled == '_') … … 1846 1866 success = 1; 1847 1867 } 1848 }1868 } 1849 1869 1850 1870 return success; … … 2234 2254 /* Check if ARM template with "__pt__" in it ("parameterized type") */ 2235 2255 /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */ 2236 if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = mystrstr (mangled, "__pt__")))2256 if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = strstr (mangled, "__pt__"))) 2237 2257 { 2238 2258 int len; … … 2249 2269 if (AUTO_DEMANGLING || EDG_DEMANGLING) 2250 2270 { 2251 if ((*anchor = mystrstr (mangled, "__tm__"))2252 || (*anchor = mystrstr (mangled, "__ps__"))2253 || (*anchor = mystrstr (mangled, "__pt__")))2271 if ((*anchor = strstr (mangled, "__tm__")) 2272 || (*anchor = strstr (mangled, "__ps__")) 2273 || (*anchor = strstr (mangled, "__pt__"))) 2254 2274 { 2255 2275 int len; … … 2264 2284 } 2265 2285 } 2266 else if ((*anchor = mystrstr (mangled, "__S")))2286 else if ((*anchor = strstr (mangled, "__S"))) 2267 2287 { 2268 2288 int len; … … 2314 2334 while (1) 2315 2335 { 2316 string_ clear(&arg);2336 string_delete (&arg); 2317 2337 switch (**mangled) 2318 2338 { … … 2371 2391 /* should do error checking here */ 2372 2392 while (args < e) { 2373 string_ clear(&arg);2393 string_delete (&arg); 2374 2394 2375 2395 /* Check for type or literal here */ … … 2386 2406 string_append (&arg, "("); 2387 2407 string_appends (&arg, &type_str); 2408 string_delete (&type_str); 2388 2409 string_append (&arg, ")"); 2389 2410 if (*args != 'L') … … 2403 2424 default: 2404 2425 /* Not handling other HP cfront stuff */ 2405 if (!do_type (work, &args, &arg)) 2406 goto cfront_template_args_done; 2426 { 2427 const char* old_args = args; 2428 if (!do_type (work, &args, &arg)) 2429 goto cfront_template_args_done; 2430 2431 /* Fail if we didn't make any progress: prevent infinite loop. */ 2432 if (args == old_args) 2433 return; 2434 } 2407 2435 } 2408 2436 string_appends (declp, &arg); … … 2565 2593 "__"-sequence. This is the normal case. */ 2566 2594 if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING 2567 || mystrstr (scan + 2, "__") == NULL)2595 || strstr (scan + 2, "__") == NULL) 2568 2596 { 2569 2597 demangle_function_name (work, mangled, declp, scan); … … 2708 2736 /* This block of code is a reduction in strength time optimization 2709 2737 of: 2710 scan = mystrstr (*mangled, "__"); */2738 scan = strstr (*mangled, "__"); */ 2711 2739 2712 2740 { … … 2800 2828 scan++; 2801 2829 } 2802 if ((scan = mystrstr (scan, "__")) == NULL || (*(scan + 2) == '\0'))2830 if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) 2803 2831 { 2804 2832 /* No separator (I.E. "__not_mangled"), or empty signature … … 3336 3364 else 3337 3365 { 3366 string_delete (&last_name); 3338 3367 success = do_type (work, mangled, &last_name); 3339 3368 if (!success) … … 3478 3507 const char *remembered_type; 3479 3508 int type_quals; 3480 string btype;3481 3509 type_kind_t tk = tk_none; 3482 3510 3483 string_init (&btype);3484 3511 string_init (&decl); 3485 3512 string_init (result); … … 3599 3626 do_type (work, mangled, &temp); 3600 3627 string_prepends (&decl, &temp); 3628 string_delete (&temp); 3601 3629 } 3602 3630 else if (**mangled == 't') … … 3609 3637 { 3610 3638 string_prependn (&decl, temp.b, temp.p - temp.b); 3611 string_ clear(&temp);3639 string_delete (&temp); 3612 3640 } 3613 3641 else … … 3789 3817 char buf[10]; 3790 3818 unsigned int dec = 0; 3791 string btype;3792 3819 type_kind_t tk = tk_integral; 3793 3794 string_init (&btype);3795 3820 3796 3821 /* First pick off any type qualifiers. There can be more than one. */ … … 3965 3990 case 't': 3966 3991 { 3992 string btype; 3993 string_init (&btype); 3967 3994 success = demangle_template (work, mangled, &btype, 0, 1, 1); 3968 3995 string_appends (result, &btype); 3996 string_delete (&btype); 3969 3997 break; 3970 3998 } … … 4168 4196 type vector when processing a repeated type. */ 4169 4197 if (work->previous_argument) 4170 string_ clear(work->previous_argument);4198 string_delete (work->previous_argument); 4171 4199 else 4172 { 4173 work->previous_argument = (string*) xmalloc (sizeof (string)); 4174 string_init (work->previous_argument); 4175 } 4200 work->previous_argument = (string*) xmalloc (sizeof (string)); 4176 4201 4177 4202 if (!do_type (work, mangled, work->previous_argument)) … … 4537 4562 /* Restore the previous_argument field. */ 4538 4563 if (work->previous_argument) 4539 string_delete (work->previous_argument); 4564 { 4565 string_delete (work->previous_argument); 4566 free ((char *) work->previous_argument); 4567 } 4540 4568 work->previous_argument = saved_previous_argument; 4541 4569 --work->forgetting_types; … … 4862 4890 string_append (s, buf); 4863 4891 } 4864 4865 /* To generate a standalone demangler program for testing purposes,4866 just compile and link this file with -DMAIN and libiberty.a. When4867 run, it demangles each command line arg, or each stdin string, and4868 prints the result on stdout. */4869 4870 #ifdef MAIN4871 4872 #include "getopt.h"4873 4874 static const char *program_name;4875 static const char *program_version = VERSION;4876 static int flags = DMGL_PARAMS | DMGL_ANSI;4877 4878 static void demangle_it PARAMS ((char *));4879 static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;4880 static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;4881 static void print_demangler_list PARAMS ((FILE *));4882 4883 static void4884 demangle_it (mangled_name)4885 char *mangled_name;4886 {4887 char *result;4888 4889 result = cplus_demangle (mangled_name, flags);4890 if (result == NULL)4891 {4892 printf ("%s\n", mangled_name);4893 }4894 else4895 {4896 printf ("%s\n", result);4897 free (result);4898 }4899 }4900 4901 static void4902 print_demangler_list (stream)4903 FILE *stream;4904 {4905 struct demangler_engine *demangler;4906 4907 fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name);4908 4909 for (demangler = libiberty_demanglers + 1;4910 demangler->demangling_style != unknown_demangling;4911 ++demangler)4912 fprintf (stream, ",%s", demangler->demangling_style_name);4913 4914 fprintf (stream, "}");4915 }4916 4917 static void4918 usage (stream, status)4919 FILE *stream;4920 int status;4921 {4922 fprintf (stream, "\4923 Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores] \n",4924 program_name);4925 4926 fprintf (stream, "\4927 [-s ");4928 print_demangler_list (stream);4929 fprintf (stream, "]\n");4930 4931 fprintf (stream, "\4932 [--format ");4933 print_demangler_list (stream);4934 fprintf (stream, "]\n");4935 4936 fprintf (stream, "\4937 [--help] [--version] [arg...]\n");4938 exit (status);4939 }4940 4941 #define MBUF_SIZE 327674942 char mbuffer[MBUF_SIZE];4943 4944 /* Defined in the automatically-generated underscore.c. */4945 extern int prepends_underscore;4946 4947 int strip_underscore = 0;4948 4949 static struct option long_options[] = {4950 {"strip-underscores", no_argument, 0, '_'},4951 {"format", required_argument, 0, 's'},4952 {"help", no_argument, 0, 'h'},4953 {"java", no_argument, 0, 'j'},4954 {"no-strip-underscores", no_argument, 0, 'n'},4955 {"version", no_argument, 0, 'v'},4956 {0, no_argument, 0, 0}4957 };4958 4959 /* More 'friendly' abort that prints the line and file.4960 config.h can #define abort fancy_abort if you like that sort of thing. */4961 4962 void4963 fancy_abort ()4964 {4965 fatal ("Internal gcc abort.");4966 }4967 4968 4969 static const char *4970 standard_symbol_characters PARAMS ((void));4971 4972 static const char *4973 hp_symbol_characters PARAMS ((void));4974 4975 static const char *4976 gnu_v3_symbol_characters PARAMS ((void));4977 4978 /* Return the string of non-alnum characters that may occur4979 as a valid symbol component, in the standard assembler symbol4980 syntax. */4981 4982 static const char *4983 standard_symbol_characters ()4984 {4985 return "_$.";4986 }4987 4988 4989 /* Return the string of non-alnum characters that may occur4990 as a valid symbol name component in an HP object file.4991 4992 Note that, since HP's compiler generates object code straight from4993 C++ source, without going through an assembler, its mangled4994 identifiers can use all sorts of characters that no assembler would4995 tolerate, so the alphabet this function creates is a little odd.4996 Here are some sample mangled identifiers offered by HP:4997 4998 typeid*__XT24AddressIndExpClassMember_4999 [Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv5000 __ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv5001 5002 This still seems really weird to me, since nowhere else in this5003 file is there anything to recognize curly brackets, parens, etc.5004 I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me5005 this is right, but I still strongly suspect that there's a5006 misunderstanding here.5007 5008 If we decide it's better for c++filt to use HP's assembler syntax5009 to scrape identifiers out of its input, here's the definition of5010 the symbol name syntax from the HP assembler manual:5011 5012 Symbols are composed of uppercase and lowercase letters, decimal5013 digits, dollar symbol, period (.), ampersand (&), pound sign(#) and5014 underscore (_). A symbol can begin with a letter, digit underscore or5015 dollar sign. If a symbol begins with a digit, it must contain a5016 non-digit character.5017 5018 So have fun. */5019 static const char *5020 hp_symbol_characters ()5021 {5022 return "_$.<>#,*&[]:(){}";5023 }5024 5025 5026 /* Return the string of non-alnum characters that may occur5027 as a valid symbol component in the GNU C++ V3 ABI mangling5028 scheme. */5029 5030 static const char *5031 gnu_v3_symbol_characters ()5032 {5033 return "_$.";5034 }5035 5036 5037 extern int main PARAMS ((int, char **));5038 5039 int5040 main (argc, argv)5041 int argc;5042 char **argv;5043 {5044 char *result;5045 int c;5046 const char *valid_symbols;5047 5048 program_name = argv[0];5049 5050 strip_underscore = prepends_underscore;5051 5052 while ((c = getopt_long (argc, argv, "_ns:j", long_options, (int *) 0)) != EOF)5053 {5054 switch (c)5055 {5056 case '?':5057 usage (stderr, 1);5058 break;5059 case 'h':5060 usage (stdout, 0);5061 case 'n':5062 strip_underscore = 0;5063 break;5064 case 'v':5065 printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version);5066 return (0);5067 case '_':5068 strip_underscore = 1;5069 break;5070 case 'j':5071 flags |= DMGL_JAVA;5072 break;5073 case 's':5074 {5075 enum demangling_styles style;5076 5077 style = cplus_demangle_name_to_style (optarg);5078 if (style == unknown_demangling)5079 {5080 fprintf (stderr, "%s: unknown demangling style `%s'\n",5081 program_name, optarg);5082 return (1);5083 }5084 else5085 cplus_demangle_set_style (style);5086 }5087 break;5088 }5089 }5090 5091 if (optind < argc)5092 {5093 for ( ; optind < argc; optind++)5094 {5095 demangle_it (argv[optind]);5096 }5097 }5098 else5099 {5100 switch (current_demangling_style)5101 {5102 case gnu_demangling:5103 case lucid_demangling:5104 case arm_demangling:5105 case java_demangling:5106 case edg_demangling:5107 case gnat_demangling:5108 case auto_demangling:5109 valid_symbols = standard_symbol_characters ();5110 break;5111 case hp_demangling:5112 valid_symbols = hp_symbol_characters ();5113 break;5114 case gnu_v3_demangling:5115 valid_symbols = gnu_v3_symbol_characters ();5116 break;5117 default:5118 /* Folks should explicitly indicate the appropriate alphabet for5119 each demangling. Providing a default would allow the5120 question to go unconsidered. */5121 abort ();5122 }5123 5124 for (;;)5125 {5126 int i = 0;5127 c = getchar ();5128 /* Try to read a label. */5129 while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))5130 {5131 if (i >= MBUF_SIZE-1)5132 break;5133 mbuffer[i++] = c;5134 c = getchar ();5135 }5136 if (i > 0)5137 {5138 int skip_first = 0;5139 5140 if (mbuffer[0] == '.')5141 ++skip_first;5142 if (strip_underscore && mbuffer[skip_first] == '_')5143 ++skip_first;5144 5145 if (skip_first > i)5146 skip_first = i;5147 5148 mbuffer[i] = 0;5149 5150 result = cplus_demangle (mbuffer + skip_first, flags);5151 if (result)5152 {5153 if (mbuffer[0] == '.')5154 putc ('.', stdout);5155 fputs (result, stdout);5156 free (result);5157 }5158 else5159 fputs (mbuffer, stdout);5160 5161 fflush (stdout);5162 }5163 if (c == EOF)5164 break;5165 putchar (c);5166 fflush (stdout);5167 }5168 }5169 5170 return (0);5171 }5172 5173 static void5174 fatal (str)5175 const char *str;5176 {5177 fprintf (stderr, "%s: %s\n", program_name, str);5178 exit (1);5179 }5180 5181 PTR5182 xmalloc (size)5183 size_t size;5184 {5185 register PTR value = (PTR) malloc (size);5186 if (value == 0)5187 fatal ("virtual memory exhausted");5188 return value;5189 }5190 5191 PTR5192 xrealloc (ptr, size)5193 PTR ptr;5194 size_t size;5195 {5196 register PTR value = (PTR) realloc (ptr, size);5197 if (value == 0)5198 fatal ("virtual memory exhausted");5199 return value;5200 }5201 #endif /* main */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.