#define DEBUG(level, params) /*nothing*/
#endif
-MODULE_ID("$Id: comp_hash.c,v 1.16 1998/02/11 12:13:53 tom Exp $")
+MODULE_ID("$Id: comp_hash.c,v 1.21 1999/06/26 21:25:11 tom Exp $")
static int hash_function(const char *);
*/
#ifdef MAIN_PROGRAM
+
+#undef MODULE_ID
+#define MODULE_ID(id) /*nothing*/
+#include <tinfo/doalloc.c>
+
static void _nc_make_hash_table(struct name_table_entry *table,
struct name_table_entry **hash_table)
{
* performance enhancement).
*/
-#if !HAVE_STRDUP
-static char *strdup (char *s)
-{
- char *p;
-
- p = malloc(strlen(s)+1);
- if (p)
- strcpy(p,s);
- return(p);
-}
-#endif /* not HAVE_STRDUP */
-
#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
static char **parse_columns(char *buffer)
int col = 0;
- if (list == 0)
- list = typeCalloc(char *, MAX_COLUMNS);
+ if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
+ return(0);
if (*buffer != '#') {
while (*buffer != '\0') {
printf("{\n");
for (n = 0; n < HASHTABSIZE; n++) {
if (hash_table[n] != 0) {
- sprintf(buffer, "_nc_%s_table + %3d",
+ sprintf(buffer, "_nc_%s_table + %3ld",
root_name,
- hash_table[n] - name_table);
+ (long) (hash_table[n] - name_table));
} else {
strcpy(buffer, "0");
}