| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $ */ | | 1 | /* $NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $ */ |
2 | /* | | 2 | /* |
3 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | | 3 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for |
4 | * unrestricted use provided that this legend is included on all tape | | 4 | * unrestricted use provided that this legend is included on all tape |
5 | * media and as a part of the software program in whole or part. Users | | 5 | * media and as a part of the software program in whole or part. Users |
6 | * may copy or modify Sun RPC without charge, but are not authorized | | 6 | * may copy or modify Sun RPC without charge, but are not authorized |
7 | * to license or distribute it to anyone else except as part of a product or | | 7 | * to license or distribute it to anyone else except as part of a product or |
8 | * program developed by the user or with the express written consent of | | 8 | * program developed by the user or with the express written consent of |
9 | * Sun Microsystems, Inc. | | 9 | * Sun Microsystems, Inc. |
10 | * | | 10 | * |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. |
14 | * | | 14 | * |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | * 2550 Garcia Avenue | | 28 | * 2550 Garcia Avenue |
29 | * Mountain View, California 94043 | | 29 | * Mountain View, California 94043 |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #if HAVE_NBTOOL_CONFIG_H | | 32 | #if HAVE_NBTOOL_CONFIG_H |
33 | #include "nbtool_config.h" | | 33 | #include "nbtool_config.h" |
34 | #endif | | 34 | #endif |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | #if defined(__RCSID) && !defined(lint) | | 37 | #if defined(__RCSID) && !defined(lint) |
38 | #if 0 | | 38 | #if 0 |
39 | static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; | | 39 | static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; |
40 | #else | | 40 | #else |
41 | __RCSID("$NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $"); | | 41 | __RCSID("$NetBSD: rpc_cout.c,v 1.35 2015/05/09 23:14:22 dholland Exp $"); |
42 | #endif | | 42 | #endif |
43 | #endif | | 43 | #endif |
44 | | | 44 | |
45 | /* | | 45 | /* |
46 | * rpc_cout.c, XDR routine outputter for the RPC protocol compiler | | 46 | * rpc_cout.c, XDR routine outputter for the RPC protocol compiler |
47 | */ | | 47 | */ |
48 | #include <ctype.h> | | 48 | #include <ctype.h> |
49 | #include <err.h> | | 49 | #include <err.h> |
50 | #include <stdio.h> | | 50 | #include <stdio.h> |
51 | #include <stdlib.h> | | 51 | #include <stdlib.h> |
52 | #include <string.h> | | 52 | #include <string.h> |
53 | #include "rpc_scan.h" | | 53 | #include "rpc_scan.h" |
54 | #include "rpc_parse.h" | | 54 | #include "rpc_parse.h" |
| @@ -469,28 +469,27 @@ emit_struct(definition *def) | | | @@ -469,28 +469,27 @@ emit_struct(definition *def) |
469 | s_print(ptemp, "%s%s * %d", plus, dl->decl.array_max, ptr->length); | | 469 | s_print(ptemp, "%s%s * %d", plus, dl->decl.array_max, ptr->length); |
470 | else | | 470 | else |
471 | s_print(ptemp, "%s%s", plus, dl->decl.array_max); | | 471 | s_print(ptemp, "%s%s", plus, dl->decl.array_max); |
472 | | | 472 | |
473 | /* now concatenate to sizestr !!!! */ | | 473 | /* now concatenate to sizestr !!!! */ |
474 | if (sizestr == NULL) | | 474 | if (sizestr == NULL) |
475 | sizestr = strdup(ptemp); | | 475 | sizestr = strdup(ptemp); |
476 | else { | | 476 | else { |
477 | char *nsizestr; | | 477 | char *nsizestr; |
478 | | | 478 | |
479 | nsizestr = (char *) realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); | | 479 | nsizestr = (char *) realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); |
480 | if (nsizestr == NULL) { | | 480 | if (nsizestr == NULL) { |
481 | | | 481 | |
482 | f_print(stderr, "Fatal error : no memory\n"); | | 482 | errx(EXIT_FAILURE, "Out of memory"); |
483 | crash(); | | | |
484 | } | | 483 | } |
485 | sizestr = nsizestr; | | 484 | sizestr = nsizestr; |
486 | sizestr = strcat(sizestr, ptemp); /* build up length of | | 485 | sizestr = strcat(sizestr, ptemp); /* build up length of |
487 | * array */ | | 486 | * array */ |
488 | | | 487 | |
489 | } | | 488 | } |
490 | } | | 489 | } |
491 | | | 490 | |
492 | } else { | | 491 | } else { |
493 | if (i > 0) { | | 492 | if (i > 0) { |
494 | if (sizestr == NULL && size < doinline) { | | 493 | if (sizestr == NULL && size < doinline) { |
495 | /* don't expand into inline | | 494 | /* don't expand into inline |
496 | * code if size < doinline */ | | 495 | * code if size < doinline */ |