* c-typeprint.c (c_type_print_base): Avoid dereferencing NULL

names for TYPE_CODE_STRUCT and TYPE_CODE_UNION types.
	TYPE_CODE_ENUM was already testing for this.
This commit is contained in:
Fred Fish 1993-05-30 00:03:59 +00:00
parent 69b2f0fe81
commit 86e3a5e40f
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Sat May 29 15:59:29 1993 Fred Fish (fnf@cygnus.com)
* c-typeprint.c (c_type_print_base): Avoid dereferencing NULL
names for TYPE_CODE_STRUCT and TYPE_CODE_UNION types.
TYPE_CODE_ENUM was already testing for this.
Fri May 28 17:18:05 1993 Stu Grossman (grossman@cygnus.com) Fri May 28 17:18:05 1993 Stu Grossman (grossman@cygnus.com)
* Makefile.in: Add new file ser-tcp.c. * Makefile.in: Add new file ser-tcp.c.

View File

@ -514,7 +514,7 @@ c_type_print_base (type, stream, show, level)
possible that we should have a better way of distinguising possible that we should have a better way of distinguising
tag names from typedef'd names. (e.g. a new tagname field in tag names from typedef'd names. (e.g. a new tagname field in
the struct type). */ the struct type). */
if (strncmp (name, "struct ", 7) == 0) if (name != NULL && strncmp (name, "struct ", 7) == 0)
{ {
fputs_filtered (name + 7, stream); fputs_filtered (name + 7, stream);
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
@ -544,7 +544,7 @@ c_type_print_base (type, stream, show, level)
possible that we should have a better way of distinguising possible that we should have a better way of distinguising
tag names from typedef'd names. (e.g. a new tagname field in tag names from typedef'd names. (e.g. a new tagname field in
the struct type). */ the struct type). */
if (strncmp (name, "union ", 6) == 0) if (name != NULL && strncmp (name, "union ", 6) == 0)
{ {
fputs_filtered (name + 6, stream); fputs_filtered (name + 6, stream);
fputs_filtered (" ", stream); fputs_filtered (" ", stream);