2007-08-29 Michael Snyder * dwarf2read.c (determine_prefix): Do not send NULL to strlen. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.230 diff -p -r1.230 dwarf2read.c *** dwarf2read.c 23 Aug 2007 18:08:28 -0000 1.230 --- dwarf2read.c 29 Aug 2007 21:45:22 -0000 *************** determine_prefix (struct die_info *die, *** 7677,7696 **** } /* Return a newly-allocated string formed by concatenating PREFIX and ! SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or empty, then ! simply copy the SUFFIX or PREFIX, respectively. If OBS is non-null, ! perform an obconcat, otherwise allocate storage for the result. The CU argument ! is used to determine the language and hence, the appropriate separator. */ #define MAX_SEP_LEN 2 /* sizeof ("::") */ static char * ! typename_concat (struct obstack *obs, const char *prefix, const char *suffix, ! struct dwarf2_cu *cu) { char *sep; ! if (suffix == NULL || suffix[0] == '\0' || prefix == NULL || prefix[0] == '\0') sep = ""; else if (cu->language == language_java) sep = "."; --- 7677,7703 ---- } /* Return a newly-allocated string formed by concatenating PREFIX and ! SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or ! empty, then simply copy the SUFFIX or PREFIX, respectively. If OBS ! is non-null, perform an obconcat, otherwise allocate storage for ! the result. The CU argument is used to determine the language and ! hence, the appropriate separator. */ #define MAX_SEP_LEN 2 /* sizeof ("::") */ static char * ! typename_concat (struct obstack *obs, const char *prefix, ! const char *suffix, struct dwarf2_cu *cu) { char *sep; ! /* Do not ask strlen to deal with a null pointer! */ ! if (suffix == NULL) ! suffix = ""; ! if (prefix == NULL) ! prefix = ""; ! ! if (suffix[0] == '\0' || prefix[0] == '\0') sep = ""; else if (cu->language == language_java) sep = "."; *************** typename_concat (struct obstack *obs, co *** 7699,7705 **** if (obs == NULL) { ! char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1); retval[0] = '\0'; if (prefix) --- 7706,7713 ---- if (obs == NULL) { ! char *retval = ! xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1); retval[0] = '\0'; if (prefix)