aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorGerd Moellmann2000-06-06 10:39:01 +0000
committerGerd Moellmann2000-06-06 10:39:01 +0000
commit9aa665aab5d27b2619bcafa66950cb13823baaf1 (patch)
tree99c9eb63e00204a03d34858993bccccb83294d00 /lib-src
parent3017fdd1e33e71b1f9ba1c38e633ca0d572cc60b (diff)
downloademacs-9aa665aab5d27b2619bcafa66950cb13823baaf1.tar.gz
emacs-9aa665aab5d27b2619bcafa66950cb13823baaf1.zip
(ymalloc): Renamed from xmalloc.
(yrealloc): Renamed from xrealloc.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ebrowse.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 26a18efe237..c9b43175d9e 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -472,7 +472,7 @@ void add_member_defn P_ ((struct sym *, char *, char *,
472void add_member_decl P_ ((struct sym *, char *, char *, int, 472void add_member_decl P_ ((struct sym *, char *, char *, int,
473 unsigned, int, int, int, int)); 473 unsigned, int, int, int, int));
474void dump_roots P_ ((FILE *)); 474void dump_roots P_ ((FILE *));
475void *xmalloc P_ ((int)); 475void *ymalloc P_ ((int));
476void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); 476void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int));
477void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); 477void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int));
478void add_define P_ ((char *, char *, int)); 478void add_define P_ ((char *, char *, int));
@@ -533,10 +533,12 @@ yyerror (format, a1, a2, a3, a4, a5)
533 533
534 534
535/* Like malloc but print an error and exit if not enough memory is 535/* Like malloc but print an error and exit if not enough memory is
536 available. */ 536 available. This isn't called `xmalloc' because src/m/alpha.h,
537 and maybe others, contain an incompatible prototype for xmalloc
538 and xrealloc. */
537 539
538void * 540void *
539xmalloc (nbytes) 541ymalloc (nbytes)
540 int nbytes; 542 int nbytes;
541{ 543{
542 void *p = malloc (nbytes); 544 void *p = malloc (nbytes);
@@ -552,7 +554,7 @@ xmalloc (nbytes)
552/* Like realloc but print an error and exit if out of memory. */ 554/* Like realloc but print an error and exit if out of memory. */
553 555
554void * 556void *
555xrealloc (p, sz) 557yrealloc (p, sz)
556 void *p; 558 void *p;
557 int sz; 559 int sz;
558{ 560{
@@ -574,7 +576,7 @@ xstrdup (s)
574 char *s; 576 char *s;
575{ 577{
576 if (s) 578 if (s)
577 s = strcpy (xmalloc (strlen (s) + 1), s); 579 s = strcpy (ymalloc (strlen (s) + 1), s);
578 return s; 580 return s;
579} 581}
580 582
@@ -627,7 +629,7 @@ add_sym (name, nested_in_class)
627 puts (name); 629 puts (name);
628 } 630 }
629 631
630 sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); 632 sym = (struct sym *) ymalloc (sizeof *sym + strlen (name));
631 bzero (sym, sizeof *sym); 633 bzero (sym, sizeof *sym);
632 strcpy (sym->name, name); 634 strcpy (sym->name, name);
633 sym->namesp = scope; 635 sym->namesp = scope;
@@ -656,8 +658,8 @@ add_link (super, sub)
656 /* Avoid duplicates. */ 658 /* Avoid duplicates. */
657 if (p == NULL || p->sym != sub) 659 if (p == NULL || p->sym != sub)
658 { 660 {
659 lnk = (struct link *) xmalloc (sizeof *lnk); 661 lnk = (struct link *) ymalloc (sizeof *lnk);
660 lnk2 = (struct link *) xmalloc (sizeof *lnk2); 662 lnk2 = (struct link *) ymalloc (sizeof *lnk2);
661 663
662 lnk->sym = sub; 664 lnk->sym = sub;
663 lnk->next = p; 665 lnk->next = p;
@@ -953,7 +955,7 @@ add_member (cls, name, var, sc, hash)
953 int sc; 955 int sc;
954 unsigned hash; 956 unsigned hash;
955{ 957{
956 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); 958 struct member *m = (struct member *) ymalloc (sizeof *m + strlen (name));
957 struct member **list; 959 struct member **list;
958 struct member *p; 960 struct member *p;
959 struct member *prev; 961 struct member *prev;
@@ -1065,7 +1067,7 @@ struct sym *
1065make_namespace (name) 1067make_namespace (name)
1066 char *name; 1068 char *name;
1067{ 1069{
1068 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); 1070 struct sym *s = (struct sym *) ymalloc (sizeof *s + strlen (name));
1069 bzero (s, sizeof *s); 1071 bzero (s, sizeof *s);
1070 strcpy (s->name, name); 1072 strcpy (s->name, name);
1071 s->next = all_namespaces; 1073 s->next = all_namespaces;
@@ -1120,7 +1122,7 @@ register_namespace_alias (new_name, old_name)
1120 if (streq (new_name, p->name)) 1122 if (streq (new_name, p->name))
1121 return; 1123 return;
1122 1124
1123 al = (struct alias *) xmalloc (sizeof *al + strlen (new_name)); 1125 al = (struct alias *) ymalloc (sizeof *al + strlen (new_name));
1124 strcpy (al->name, new_name); 1126 strcpy (al->name, new_name);
1125 al->next = p->namesp_aliases; 1127 al->next = p->namesp_aliases;
1126 p->namesp_aliases = al; 1128 p->namesp_aliases = al;
@@ -1138,7 +1140,7 @@ enter_namespace (name)
1138 if (namespace_sp == namespace_stack_size) 1140 if (namespace_sp == namespace_stack_size)
1139 { 1141 {
1140 int size = max (10, 2 * namespace_stack_size); 1142 int size = max (10, 2 * namespace_stack_size);
1141 namespace_stack = (struct sym **) xrealloc (namespace_stack, size); 1143 namespace_stack = (struct sym **) yrealloc (namespace_stack, size);
1142 namespace_stack_size = size; 1144 namespace_stack_size = size;
1143 } 1145 }
1144 1146
@@ -1198,7 +1200,7 @@ ensure_scope_buffer_room (len)
1198 if (scope_buffer_len + len >= scope_buffer_size) 1200 if (scope_buffer_len + len >= scope_buffer_size)
1199 { 1201 {
1200 int new_size = max (2 * scope_buffer_size, scope_buffer_len + len); 1202 int new_size = max (2 * scope_buffer_size, scope_buffer_len + len);
1201 scope_buffer = (char *) xrealloc (new_size); 1203 scope_buffer = (char *) yrealloc (new_size);
1202 scope_buffer_size = new_size; 1204 scope_buffer_size = new_size;
1203 } 1205 }
1204} 1206}
@@ -1250,7 +1252,7 @@ sym_scope (p)
1250 if (!scope_buffer) 1252 if (!scope_buffer)
1251 { 1253 {
1252 scope_buffer_size = 1024; 1254 scope_buffer_size = 1024;
1253 scope_buffer = (char *) xmalloc (scope_buffer_size); 1255 scope_buffer = (char *) ymalloc (scope_buffer_size);
1254 } 1256 }
1255 1257
1256 *scope_buffer = '\0'; 1258 *scope_buffer = '\0';
@@ -1667,7 +1669,7 @@ yylex ()
1667 if (p == yytext_end - 1) 1669 if (p == yytext_end - 1)
1668 { 1670 {
1669 int size = yytext_end - yytext; 1671 int size = yytext_end - yytext;
1670 yytext = (char *) xrealloc (yytext, 2 * size); 1672 yytext = (char *) yrealloc (yytext, 2 * size);
1671 yytext_end = yytext + 2 * size; 1673 yytext_end = yytext + 2 * size;
1672 p = yytext + size - 1; 1674 p = yytext + size - 1;
1673 } 1675 }
@@ -1945,7 +1947,7 @@ matching_regexp ()
1945 1947
1946 if (buffer == NULL) 1948 if (buffer == NULL)
1947 { 1949 {
1948 buffer = (char *) xmalloc (max_regexp); 1950 buffer = (char *) ymalloc (max_regexp);
1949 end_buf = &buffer[max_regexp] - 1; 1951 end_buf = &buffer[max_regexp] - 1;
1950 } 1952 }
1951 1953
@@ -2090,7 +2092,7 @@ re_init_scanner ()
2090 if (yytext == NULL) 2092 if (yytext == NULL)
2091 { 2093 {
2092 int size = 256; 2094 int size = 256;
2093 yytext = (char *) xmalloc (size * sizeof *yytext); 2095 yytext = (char *) ymalloc (size * sizeof *yytext);
2094 yytext_end = yytext + size; 2096 yytext_end = yytext + size;
2095 } 2097 }
2096} 2098}
@@ -2106,7 +2108,7 @@ insert_keyword (name, tk)
2106{ 2108{
2107 char *s; 2109 char *s;
2108 unsigned h = 0; 2110 unsigned h = 0;
2109 struct kw *k = (struct kw *) xmalloc (sizeof *k); 2111 struct kw *k = (struct kw *) ymalloc (sizeof *k);
2110 2112
2111 for (s = name; *s; ++s) 2113 for (s = name; *s; ++s)
2112 h = (h << 1) ^ *s; 2114 h = (h << 1) ^ *s;
@@ -2129,7 +2131,7 @@ init_scanner ()
2129 2131
2130 /* Allocate the input buffer */ 2132 /* Allocate the input buffer */
2131 inbuffer_size = READ_CHUNK_SIZE + 1; 2133 inbuffer_size = READ_CHUNK_SIZE + 1;
2132 inbuffer = in = (char *) xmalloc (inbuffer_size); 2134 inbuffer = in = (char *) ymalloc (inbuffer_size);
2133 yyline = 1; 2135 yyline = 1;
2134 2136
2135 /* Set up character class vectors. */ 2137 /* Set up character class vectors. */
@@ -2784,7 +2786,7 @@ operator_name (sc)
2784 if (len > id_size) 2786 if (len > id_size)
2785 { 2787 {
2786 int new_size = max (len, 2 * id_size); 2788 int new_size = max (len, 2 * id_size);
2787 id = (char *) xrealloc (id, new_size); 2789 id = (char *) yrealloc (id, new_size);
2788 id_size = new_size; 2790 id_size = new_size;
2789 } 2791 }
2790 strcpy (id, s); 2792 strcpy (id, s);
@@ -2810,7 +2812,7 @@ operator_name (sc)
2810 if (len > id_size) 2812 if (len > id_size)
2811 { 2813 {
2812 int new_size = max (len, 2 * id_size); 2814 int new_size = max (len, 2 * id_size);
2813 id = (char *) xrealloc (id, new_size); 2815 id = (char *) yrealloc (id, new_size);
2814 id_size = new_size; 2816 id_size = new_size;
2815 } 2817 }
2816 strcpy (id, "operator"); 2818 strcpy (id, "operator");
@@ -2826,7 +2828,7 @@ operator_name (sc)
2826 if (len > id_size) 2828 if (len > id_size)
2827 { 2829 {
2828 int new_size = max (len, 2 * id_size); 2830 int new_size = max (len, 2 * id_size);
2829 id = (char *) xrealloc (id, new_size); 2831 id = (char *) yrealloc (id, new_size);
2830 id_size = new_size; 2832 id_size = new_size;
2831 } 2833 }
2832 2834
@@ -2864,7 +2866,7 @@ parse_qualified_ident_or_type (last_id)
2864 int len = strlen (yytext) + 1; 2866 int len = strlen (yytext) + 1;
2865 if (len > id_size) 2867 if (len > id_size)
2866 { 2868 {
2867 id = (char *) xrealloc (id, len); 2869 id = (char *) yrealloc (id, len);
2868 id_size = len; 2870 id_size = len;
2869 } 2871 }
2870 strcpy (id, yytext); 2872 strcpy (id, yytext);
@@ -2904,7 +2906,7 @@ parse_qualified_param_ident_or_type (last_id)
2904 int len = strlen (yytext) + 1; 2906 int len = strlen (yytext) + 1;
2905 if (len > id_size) 2907 if (len > id_size)
2906 { 2908 {
2907 id = (char *) xrealloc (id, len); 2909 id = (char *) yrealloc (id, len);
2908 id_size = len; 2910 id_size = len;
2909 } 2911 }
2910 strcpy (id, yytext); 2912 strcpy (id, yytext);
@@ -3350,8 +3352,8 @@ add_search_path (path_list)
3350 while (*path_list && *path_list != PATH_LIST_SEPARATOR) 3352 while (*path_list && *path_list != PATH_LIST_SEPARATOR)
3351 ++path_list; 3353 ++path_list;
3352 3354
3353 p = (struct search_path *) xmalloc (sizeof *p); 3355 p = (struct search_path *) ymalloc (sizeof *p);
3354 p->path = (char *) xmalloc (path_list - start + 1); 3356 p->path = (char *) ymalloc (path_list - start + 1);
3355 memcpy (p->path, start, path_list - start); 3357 memcpy (p->path, start, path_list - start);
3356 p->path[path_list - start] = '\0'; 3358 p->path[path_list - start] = '\0';
3357 p->next = NULL; 3359 p->next = NULL;
@@ -3393,7 +3395,7 @@ open_file (file)
3393 if (len + 1 >= buffer_size) 3395 if (len + 1 >= buffer_size)
3394 { 3396 {
3395 buffer_size = max (len + 1, 2 * buffer_size); 3397 buffer_size = max (len + 1, 2 * buffer_size);
3396 buffer = (char *) xrealloc (buffer, buffer_size); 3398 buffer = (char *) yrealloc (buffer, buffer_size);
3397 } 3399 }
3398 3400
3399 strcpy (buffer, path->path); 3401 strcpy (buffer, path->path);
@@ -3488,7 +3490,7 @@ process_file (file)
3488 if (nread + READ_CHUNK_SIZE >= inbuffer_size) 3490 if (nread + READ_CHUNK_SIZE >= inbuffer_size)
3489 { 3491 {
3490 inbuffer_size = nread + READ_CHUNK_SIZE + 1; 3492 inbuffer_size = nread + READ_CHUNK_SIZE + 1;
3491 inbuffer = (char *) xrealloc (inbuffer, inbuffer_size); 3493 inbuffer = (char *) yrealloc (inbuffer, inbuffer_size);
3492 } 3494 }
3493 3495
3494 nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); 3496 nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp);
@@ -3528,7 +3530,7 @@ read_line (fp)
3528 if (i >= buffer_size) 3530 if (i >= buffer_size)
3529 { 3531 {
3530 buffer_size = max (100, buffer_size * 2); 3532 buffer_size = max (100, buffer_size * 2);
3531 buffer = (char *) xrealloc (buffer, buffer_size); 3533 buffer = (char *) yrealloc (buffer, buffer_size);
3532 } 3534 }
3533 3535
3534 buffer[i++] = c; 3536 buffer[i++] = c;
@@ -3540,7 +3542,7 @@ read_line (fp)
3540 if (i == buffer_size) 3542 if (i == buffer_size)
3541 { 3543 {
3542 buffer_size = max (100, buffer_size * 2); 3544 buffer_size = max (100, buffer_size * 2);
3543 buffer = (char *) xrealloc (buffer, buffer_size); 3545 buffer = (char *) yrealloc (buffer, buffer_size);
3544 } 3546 }
3545 3547
3546 buffer[i] = '\0'; 3548 buffer[i] = '\0';
@@ -3588,7 +3590,7 @@ main (argc, argv)
3588 if (n_input_files == input_filenames_size) 3590 if (n_input_files == input_filenames_size)
3589 { 3591 {
3590 input_filenames_size = max (10, 2 * input_filenames_size); 3592 input_filenames_size = max (10, 2 * input_filenames_size);
3591 input_filenames = (char **) xrealloc (input_filenames, 3593 input_filenames = (char **) yrealloc (input_filenames,
3592 input_filenames_size); 3594 input_filenames_size);
3593 } 3595 }
3594 input_filenames[n_input_files++] = xstrdup (optarg); 3596 input_filenames[n_input_files++] = xstrdup (optarg);