WINCHAIN cleanup
This started out as some formatting cleanup for src/windows.c but ended up removing calloc() from the WINCHAIN code, plus fixing a couple of compiler complaints for win/chain/wc_trace.c. I tried to actually run with +trace enabled and never managed to get anything to happen. trace_procs_init() was never called. I've never tried to use it before so don't know whether something which used to work has gotten broken or I'm just doing it wrong.
This commit is contained in:
@@ -64,7 +64,8 @@ STATIC_DCL void FDECL(dump_clear_nhwindow, (winid));
|
||||
STATIC_DCL void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid));
|
||||
STATIC_DCL void FDECL(dump_start_menu, (winid));
|
||||
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, const char *, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P,
|
||||
CHAR_P, int, const char *, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(dump_end_menu, (winid, const char *));
|
||||
STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
|
||||
STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *));
|
||||
@@ -145,14 +146,22 @@ static struct winlink *chain = 0;
|
||||
static struct winlink *
|
||||
wl_new()
|
||||
{
|
||||
return calloc(1, sizeof(struct winlink));
|
||||
struct winlink *wl = (struct winlink *) alloc(sizeof *wl);
|
||||
|
||||
wl->nextlink = 0;
|
||||
wl->wincp = 0;
|
||||
wl->linkdata = 0;
|
||||
|
||||
return wl;
|
||||
}
|
||||
|
||||
static void
|
||||
wl_addhead(struct winlink *wl)
|
||||
{
|
||||
wl->nextlink = chain;
|
||||
chain = wl;
|
||||
}
|
||||
|
||||
static void
|
||||
wl_addtail(struct winlink *wl)
|
||||
{
|
||||
@@ -255,24 +264,28 @@ const char *s;
|
||||
|
||||
if (!winchoices[0].procs) {
|
||||
raw_printf("No window types?");
|
||||
exit(EXIT_FAILURE);
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
}
|
||||
if (!winchoices[1].procs) {
|
||||
config_error_add("Window type %s not recognized. The only choice is: %s",
|
||||
s, winchoices[0].procs->name);
|
||||
config_error_add(
|
||||
"Window type %s not recognized. The only choice is: %s",
|
||||
s, winchoices[0].procs->name);
|
||||
} else {
|
||||
char buf[BUFSZ];
|
||||
boolean first = TRUE;
|
||||
|
||||
buf[0] = '\0';
|
||||
for (i = 0; winchoices[i].procs; i++) {
|
||||
if ('+' == winchoices[i].procs->name[0])
|
||||
continue;
|
||||
if ('-' == winchoices[i].procs->name[0])
|
||||
continue;
|
||||
Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name);
|
||||
Sprintf(eos(buf), "%s%s",
|
||||
first ? "" : ", ", winchoices[i].procs->name);
|
||||
first = FALSE;
|
||||
}
|
||||
config_error_add("Window type %s not recognized. Choices are: %s", s, buf);
|
||||
config_error_add("Window type %s not recognized. Choices are: %s",
|
||||
s, buf);
|
||||
}
|
||||
|
||||
if (windowprocs.win_raw_print == def_raw_print)
|
||||
@@ -291,6 +304,7 @@ const char *s;
|
||||
continue;
|
||||
if (!strcmpi(s, winchoices[i].procs->name)) {
|
||||
struct winlink *p = wl_new();
|
||||
|
||||
p->wincp = &winchoices[i];
|
||||
wl_addtail(p);
|
||||
/* NB: The ini_routine() will be called during commit. */
|
||||
@@ -307,7 +321,7 @@ const char *s;
|
||||
raw_printf(" %s", winchoices[i].procs->name);
|
||||
}
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -494,7 +508,8 @@ static short FDECL(hup_set_font_name, (winid, char *));
|
||||
#endif
|
||||
static char *NDECL(hup_get_color_string);
|
||||
#endif /* CHANGE_COLOR */
|
||||
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, unsigned long *));
|
||||
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int,
|
||||
unsigned long *));
|
||||
|
||||
static int NDECL(hup_int_ndecl);
|
||||
static void NDECL(hup_void_ndecl);
|
||||
|
||||
Reference in New Issue
Block a user